public abstract class AbstractNamedComponentReference<T extends NamedReferenceable> extends AbstractReference<T> implements NamedComponentReference<T>
Note: Client code should always check for brokeness before access the referenced.
Modifier and Type | Field and Description |
---|---|
protected String |
localName |
protected String |
prefix |
protected QName |
qname |
refString
Constructor and Description |
---|
AbstractNamedComponentReference(Class<T> referencedType,
AbstractDocumentComponent parent,
String ref)
Constructor for reading.
|
AbstractNamedComponentReference(T referenced,
Class<T> referencedType,
AbstractDocumentComponent parent)
Constructor for writing.
|
Modifier and Type | Method and Description |
---|---|
protected QName |
calculateQNameLocally()
Calculate the QName based on the local information
without loading the referenced object.
|
protected void |
checkParentNotRemovedFromModel() |
protected void |
checkParentPartOfModel() |
boolean |
equals(Object obj) |
protected String |
getLocalName() |
protected AbstractDocumentComponent |
getParent()
Returns parent referencing component.
|
protected String |
getPrefix() |
QName |
getQName()
Note this method will first attempt to build the QName base on local lookup
before trying to resolve the referenced.
|
protected T |
getReferenced()
Access method for referenced.
|
String |
getRefString() |
int |
hashCode() |
boolean |
references(T target)
Return true if this reference refers to target.
|
void |
refresh() |
getType, isBroken, setReferenced, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getEffectiveNamespace
protected String prefix
protected String localName
protected QName qname
public AbstractNamedComponentReference(T referenced, Class<T> referencedType, AbstractDocumentComponent parent)
referenced
- the component being referencedreferencedType
- type of the referenced componentparent
- referencing component on which the referenced is serialized
as an attribute string value.public AbstractNamedComponentReference(Class<T> referencedType, AbstractDocumentComponent parent, String ref)
referencedType
- type of the referenced componentparent
- referencing component on which the referenced is serialized
as an attribute string value.ref
- the string value used in resolving.public boolean references(T target)
references
in interface Reference<T extends NamedReferenceable>
references
in class AbstractReference<T extends NamedReferenceable>
public String getRefString()
getRefString
in interface Reference<T extends NamedReferenceable>
getRefString
in class AbstractReference<T extends NamedReferenceable>
protected String getPrefix()
protected String getLocalName()
protected T getReferenced()
AbstractReference
getReferenced
in class AbstractReference<T extends NamedReferenceable>
public QName getQName()
getQName
in interface NamedComponentReference<T extends NamedReferenceable>
IllegalStateException
- if referencing component is discarded from
the model.protected AbstractDocumentComponent getParent()
getParent
in class AbstractReference<T extends NamedReferenceable>
protected void checkParentPartOfModel()
IllegalStateException
- if parent is not part of a model.protected void checkParentNotRemovedFromModel()
IllegalStateException
- if parent is already removed from a model.protected QName calculateQNameLocally()
public boolean equals(Object obj)
equals
in class AbstractReference<T extends NamedReferenceable>
public int hashCode()
hashCode
in class AbstractReference<T extends NamedReferenceable>
public void refresh()