public abstract class DmcTypeNamedObjectREF<HELPER extends DmcNamedObjectREF,NAMETYPE extends DmcObjectName> extends DmcAttribute<HELPER> implements Serializable
The values of this kind of attribute are derived from DmcNamedObjectREF which allows you to store just the name of an object, or the name of the object and the object itself. This provides the concept of resolved/unresolved object references. For instance, if you parse a bunch of objects from a file and they contain object reference attributes, they will appear as just the names of other objects. Later, you can attempt to resolve these references (or not). Depending on the context in which you're using your data, this mechanism gives you the option of lazily resolving (or perhaps retrieving) the objects to which this type of attribute refers.
attrInfo, ID| Constructor and Description |
|---|
DmcTypeNamedObjectREF()
Constructs a new object reference attribute.
|
DmcTypeNamedObjectREF(DmcAttributeInfo ai) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
doLazyResolution(DmcObject referrer)
This method is called from derived classes if the lazy resolution mechanism has been
turned on via the DmcOmni.
|
protected abstract String |
getDMOClassName() |
protected abstract HELPER |
getNewHelper() |
protected abstract NAMETYPE |
getNewName() |
protected abstract boolean |
isDMO(Object value)
Checks if the object is an instance of the appropriate type.
|
void |
removeBackReferences()
This method will remove back references that are associated with this reference
attribute.
|
void |
resolveReferences(DmcNameResolverIF rx)
Attempts to resolve references with the specified name resolver.
|
protected boolean |
weAreResolved() |
add, addModsMV, addModsSV, cloneIt, cloneValue, compareTo, contains, containsKey, del, deserializeIt, deserializeValue, formatValue, formatValueAsCompactJSON, formatValueAsJSON, getAttributeInfo, getByKey, getID, getMV, getMVnth, getMVSize, getName, getNew, getSV, hasValue, modifierFormat, serializeIt, serializeValue, set, setAttributeInfo, setMVnth, toOIF, toOIF, typeCheck, valueChangedMV, valueChangedSVpublic DmcTypeNamedObjectREF()
public DmcTypeNamedObjectREF(DmcAttributeInfo ai)
protected abstract HELPER getNewHelper()
protected abstract NAMETYPE getNewName()
protected abstract boolean isDMO(Object value)
value - The value to be tested.protected abstract String getDMOClassName()
public void resolveReferences(DmcNameResolverIF rx) throws DmcValueException
rx - The resolver.DmcValueException - if value problemspublic void removeBackReferences()
public boolean doLazyResolution(DmcObject referrer)
We try to find the object(s) referred to in the reference. If so, we set the object on the reference (thus making it resolved).
We also check to see if backref tracking has been turned on in DmcOmni. If so, we create the backref modifier and add it to the object we're referring to.
If the reference(s) can't be resolved we return a flag that indicates that the attribute should remove itself from the object (since there's nothing of value in it).
referrer - The object doing the referring.protected boolean weAreResolved()
Copyright © 2023. All rights reserved.