public class RelationshipManagerImpl extends Object implements RelationshipManager
Constructor and Description |
---|
RelationshipManagerImpl(ObjectProvider op)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
checkConsistency()
Method to check for consistency the managed relations of this object with the related objects.
|
protected void |
checkManyToManyBidirectionalRelation(AbstractMemberMetaData mmd,
ClassLoaderResolver clr,
ExecutionContext ec,
List<org.datanucleus.state.RelationshipManagerImpl.RelationChange> changes)
Method to check consistency of the passed field as M-N.
|
protected void |
checkManyToOneBidirectionalRelation(AbstractMemberMetaData mmd,
ClassLoaderResolver clr,
ExecutionContext ec,
List<org.datanucleus.state.RelationshipManagerImpl.RelationChange> changes)
Method to check the consistency of the passed field as N-1.
|
protected void |
checkOneToManyBidirectionalRelation(AbstractMemberMetaData mmd,
ClassLoaderResolver clr,
ExecutionContext ec,
List<org.datanucleus.state.RelationshipManagerImpl.RelationChange> changes)
Method to check the consistency of the passed field as 1-N.
|
protected void |
checkOneToOneBidirectionalRelation(AbstractMemberMetaData mmd,
ClassLoaderResolver clr,
ExecutionContext ec,
List<org.datanucleus.state.RelationshipManagerImpl.RelationChange> changes)
Method to check the consistency of the passed field as 1-1.
|
void |
clearFields()
Convenience method to clear all fields from being managed.
|
boolean |
managesField(int fieldNumber)
Accessor for whether a field is being managed.
|
void |
process()
Method to process the (bidirectional) relations for this object.
|
protected void |
processManyToManyBidirectionalRelation(AbstractMemberMetaData mmd,
ClassLoaderResolver clr,
ExecutionContext ec,
List<org.datanucleus.state.RelationshipManagerImpl.RelationChange> changes)
Method to process all M-N bidirectional fields.
|
protected void |
processManyToOneBidirectionalRelation(AbstractMemberMetaData mmd,
ClassLoaderResolver clr,
ExecutionContext ec,
List<org.datanucleus.state.RelationshipManagerImpl.RelationChange> changes)
Method to process all N-1 bidirectional fields.
|
protected void |
processOneToManyBidirectionalRelation(AbstractMemberMetaData mmd,
ClassLoaderResolver clr,
ExecutionContext ec,
List<org.datanucleus.state.RelationshipManagerImpl.RelationChange> changes)
Method to process all 1-N bidirectional fields.
|
protected void |
processOneToOneBidirectionalRelation(AbstractMemberMetaData mmd,
ClassLoaderResolver clr,
ExecutionContext ec,
List<org.datanucleus.state.RelationshipManagerImpl.RelationChange> changes)
Method to process all 1-1 bidir fields.
|
void |
relationAdd(int fieldNumber,
Object val)
Method to register a change in the contents of a container field, with an object being added.
|
void |
relationChange(int fieldNumber,
Object oldValue,
Object newValue)
Method that is called when the user calls setXXX() on a field.
|
void |
relationRemove(int fieldNumber,
Object val)
Method to register a change in the contents of a container field, with an object being removed.
|
public RelationshipManagerImpl(ObjectProvider op)
op
- ObjectProvider for the object that we are managing relations for.public void clearFields()
RelationshipManager
clearFields
in interface RelationshipManager
public void relationChange(int fieldNumber, Object oldValue, Object newValue)
RelationshipManager
relationChange
in interface RelationshipManager
fieldNumber
- Number of the fieldoldValue
- The old valuenewValue
- The new valuepublic void relationAdd(int fieldNumber, Object val)
RelationshipManager
relationAdd
in interface RelationshipManager
fieldNumber
- Number of the fieldval
- Value being addedpublic void relationRemove(int fieldNumber, Object val)
RelationshipManager
relationRemove
in interface RelationshipManager
fieldNumber
- Number of the fieldval
- Value being removedpublic boolean managesField(int fieldNumber)
managesField
in interface RelationshipManager
fieldNumber
- Number of the fieldpublic void checkConsistency()
RelationshipManager
checkConsistency
in interface RelationshipManager
public void process()
RelationshipManager
process
in interface RelationshipManager
protected void checkOneToOneBidirectionalRelation(AbstractMemberMetaData mmd, ClassLoaderResolver clr, ExecutionContext ec, List<org.datanucleus.state.RelationshipManagerImpl.RelationChange> changes)
a.b = b1; a.b = b2;so A's b field is changed from b1 to b2. The following changes are likely to be necessary
mmd
- MetaData for the fieldclr
- ClassLoader resolverec
- ExecutionContextchanges
- List of changes to the fieldprotected void checkOneToManyBidirectionalRelation(AbstractMemberMetaData mmd, ClassLoaderResolver clr, ExecutionContext ec, List<org.datanucleus.state.RelationshipManagerImpl.RelationChange> changes)
mmd
- MetaData for the fieldclr
- ClassLoader resolverec
- ExecutionContextchanges
- List of changes to the collectionprotected void checkManyToOneBidirectionalRelation(AbstractMemberMetaData mmd, ClassLoaderResolver clr, ExecutionContext ec, List<org.datanucleus.state.RelationshipManagerImpl.RelationChange> changes)
mmd
- MetaData for the fieldclr
- ClassLoader resolverec
- ExecutionContextchanges
- List of changes to the fieldprotected void checkManyToManyBidirectionalRelation(AbstractMemberMetaData mmd, ClassLoaderResolver clr, ExecutionContext ec, List<org.datanucleus.state.RelationshipManagerImpl.RelationChange> changes)
mmd
- MetaData for the fieldclr
- ClassLoader resolverec
- ExecutionContextchanges
- List of changes to the collectionprotected void processOneToOneBidirectionalRelation(AbstractMemberMetaData mmd, ClassLoaderResolver clr, ExecutionContext ec, List<org.datanucleus.state.RelationshipManagerImpl.RelationChange> changes)
a.b = b1; a.b = b2;so A's b field is changed from b1 to b2. The following changes are likely to be necessary
mmd
- MetaData for the fieldclr
- ClassLoader resolverec
- ExecutionContextchanges
- List of changes to the fieldprotected void processOneToManyBidirectionalRelation(AbstractMemberMetaData mmd, ClassLoaderResolver clr, ExecutionContext ec, List<org.datanucleus.state.RelationshipManagerImpl.RelationChange> changes)
mmd
- MetaData for the fieldclr
- ClassLoader resolverec
- ExecutionContextchanges
- List of changes to the collectionprotected void processManyToOneBidirectionalRelation(AbstractMemberMetaData mmd, ClassLoaderResolver clr, ExecutionContext ec, List<org.datanucleus.state.RelationshipManagerImpl.RelationChange> changes)
mmd
- MetaData for the fieldclr
- ClassLoader resolverec
- ExecutionContextchanges
- List of changes to the collectionprotected void processManyToManyBidirectionalRelation(AbstractMemberMetaData mmd, ClassLoaderResolver clr, ExecutionContext ec, List<org.datanucleus.state.RelationshipManagerImpl.RelationChange> changes)
mmd
- MetaData for the fieldclr
- ClassLoader resolverec
- ExecutionContextchanges
- List of changes to the collectionCopyright © 2019. All rights reserved.