@NotThreadSafe
public class IDIndex
extends java.lang.Object
XMLObject.| Modifier and Type | Field and Description |
|---|---|
private java.util.Map<java.lang.String,XMLObject> |
idMappings
Mapping of ID attributes to XMLObjects in the subtree rooted at this object's owner.
|
private XMLObject |
owner
The XMLObject which owns this ID index.
|
| Constructor and Description |
|---|
IDIndex(XMLObject newOwner)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
deregisterIDMapping(java.lang.String id)
Deregister an ID-to-XMLObject mapping for one of this object's owner's children.
|
void |
deregisterIDMappings(IDIndex idIndex)
Deregister multiple ID-to-XMLObject mappings for this object's owner's children.
|
protected java.util.Map<java.lang.String,XMLObject> |
getIDMappings()
Get the ID-to-XMLObject mappings for this object's owner's children.
|
java.util.Set<java.lang.String> |
getIDs()
Get the set of ID strings which are the index keys.
|
boolean |
isEmpty()
Return whether the index is currently empty.
|
XMLObject |
lookup(java.lang.String id)
Lookup and return the XMLObject identified by the specified ID attribute.
|
void |
registerIDMapping(java.lang.String id,
XMLObject referent)
Register an ID-to-XMLObject mapping for one of this object's owner's children.
|
void |
registerIDMappings(IDIndex idIndex)
Register multiple ID-to-XMLObject mappings for this object's owner's children.
|
@Nonnull private final XMLObject owner
@Nonnull private java.util.Map<java.lang.String,XMLObject> idMappings
public IDIndex(@Nonnull
XMLObject newOwner)
newOwner - the XMLObject which owns this ID-to-XMLObject indexpublic void registerIDMapping(@Nonnull @NotEmpty
java.lang.String id,
@Nonnull
XMLObject referent)
id - the XMLObject child's ID attribute valuereferent - the XMLObject childpublic void registerIDMappings(@Nonnull
IDIndex idIndex)
idIndex - the ID-to-XMLObject mapping to registerpublic void deregisterIDMapping(@Nonnull @NotEmpty
java.lang.String id)
id - the ID attribute value of the XMLObject child to deregisterpublic void deregisterIDMappings(@Nonnull
IDIndex idIndex)
idIndex - the ID-to-XMLObject mappings to deregister@Nullable public XMLObject lookup(@Nonnull @NotEmpty java.lang.String id)
id - the ID attribute value to lookuppublic boolean isEmpty()
@Nonnull public java.util.Set<java.lang.String> getIDs()
@Nonnull protected java.util.Map<java.lang.String,XMLObject> getIDMappings()