protected final class AssociationSyncher.OneToOneHelper extends java.lang.Object implements AssociationSyncher.Helper
Helper
interface which assumes
that there is no more than one record on either end of the association.
This has implications for the methods used to retrieve and update the
foreign record's reference to the local end of the association.Modifier and Type | Field and Description |
---|---|
private java.lang.reflect.Method |
getter
Method used to get local DMO from foreign DMO
|
private java.lang.reflect.Method |
setter
Method used to set local DMO into foreign DMO
|
Constructor and Description |
---|
OneToOneHelper(RelationInfo info)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
java.util.Set |
getLocalDMOs(Persistable foreignDMO)
Retrieve the set of local DMOs stored in a foreign DMO for this
association.
|
void |
remove(Persistable foreignDMO,
Persistable localDMO)
Remove the reference to the given local DMO from the given foreign
DMO for this association.
|
void |
replace(Persistable foreignDMO,
java.util.Set localDMOs)
Replace the local DMO stored in a foreign DMO for this association
with the contents of the given set.
|
private final java.lang.reflect.Method getter
private final java.lang.reflect.Method setter
OneToOneHelper(RelationInfo info)
info
- Object which contains information regarding the nature of
the one-to-one, foreign association.public java.util.Set getLocalDMOs(Persistable foreignDMO) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
getLocalDMOs
in interface AssociationSyncher.Helper
foreignDMO
- Foreign DMO from which to extract the set of local DMOs.null
.java.lang.IllegalAccessException
- if an access error occurs while invoking a method using
reflection.java.lang.reflect.InvocationTargetException
- if a method invoked using reflection throws an exception.public void replace(Persistable foreignDMO, java.util.Set localDMOs) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
replace
in interface AssociationSyncher.Helper
foreignDMO
- Foreign DMO which stores a reference to local DMOs.localDMOs
- The set of local DMOs which must replace the existing set.
Since this helper implementation manages a one-to-one
association, this set must not have more than one element.
However, it may be empty, in which case the local DMO
reference in the foreign DMO will be nulled out.java.lang.IllegalAccessException
- if an access error occurs while invoking a method using
reflection.java.lang.reflect.InvocationTargetException
- if a method invoked using reflection throws an exception.java.lang.IllegalArgumentException
- if localDMOs
contains more than one element.public void remove(Persistable foreignDMO, Persistable localDMO) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
localDMO
argument and assumes the intent of the caller
is simply to remove the reference entirely.remove
in interface AssociationSyncher.Helper
foreignDMO
- Foreign DMO which stores a reference to local DMOs.localDMO
- The local DMO to be removed from the existing set.java.lang.IllegalAccessException
- if an access error occurs while invoking a method using
reflection.java.lang.reflect.InvocationTargetException
- if a method invoked using reflection throws an exception.