public abstract class AbstractChildReferences extends Object implements ChildReferences
ChildReferences
implementation that can serve as a base class to provide default implementations of some
methods to simplify other implementations.Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractChildReferences.ChildReferenceWithNameIterator |
ChildReferences.BasicContext, ChildReferences.Changes, ChildReferences.ChildInsertions, ChildReferences.Context, ChildReferences.NoChanges, ChildReferences.NoContext, ChildReferences.NoSnsIndexesContext, ChildReferences.SingleNameContext, ChildReferences.WithChanges
UNKNOWN_SIZE
Constructor and Description |
---|
AbstractChildReferences() |
Modifier and Type | Method and Description |
---|---|
protected Iterator<ChildReference> |
contextSensitiveIterator(Iterator<ChildReference> original,
ChildReferences.Context context) |
protected ChildReferences.Context |
defaultContext() |
ChildReference |
getChild(Name name)
Look for the child reference that has the given name and a SNS index of '1'.
|
ChildReference |
getChild(Name name,
int snsIndex)
Look for the child reference that has the given name and SNS index.
|
ChildReference |
getChild(Path.Segment segment)
Look for the child reference that has the given name and SNS index.
|
boolean |
isEmpty()
Determine if there are no references in this container.
|
Iterator<ChildReference> |
iterator()
Get an iterator over all of the children.
|
Iterator<ChildReference> |
iterator(ChildReferences.Context context)
Get an iterator over all child references in this collection, but base the SNS indexes upon those already consumed.
|
Iterator<ChildReference> |
iterator(ChildReferences.Context context,
Collection<?> namePatterns,
NamespaceRegistry registry)
Get an iterator over all of the children that have
names (excluding same-name-sibling indexes)
matching at least one of the supplied patterns, using the supplied context. |
Iterator<ChildReference> |
iterator(ChildReferences.Context context,
Name name) |
Iterator<ChildReference> |
iterator(Collection<?> namePatterns,
NamespaceRegistry registry)
Get an iterator over all of the children that have
names (excluding same-name-sibling indexes)
matching at least one of the supplied patterns. |
Iterator<ChildReference> |
iterator(Name name)
Get an iterator over all of the children that have same name matching the supplied value.
|
Iterator<ChildReference> |
iterator(Name name,
ChildReferences.Context context)
Get an iterator over all of the children that have same name matching the supplied value.
|
boolean |
supportsGetChildReferenceByKey()
Return whether it is possible/feasible to
find a ChildReference for a child node given
only its NodeKey. |
String |
toString() |
abstract StringBuilder |
toString(StringBuilder sb) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
allowsSNS, getAllKeys, getChild, getChild, getChild, getChildCount, hasChild, size
forEach, spliterator
public boolean supportsGetChildReferenceByKey()
ChildReferences
find
a ChildReference for a child node given
only its NodeKey. Implementations that have very large numbers of children may provide an alternative way to
lookup
a child reference directly. In such cases, this method may
return false.supportsGetChildReferenceByKey
in interface ChildReferences
ChildReferences.getChild(NodeKey)
and ChildReferences.getChild(NodeKey, Context)
should be used to find the
ChildReference, or false if doing so is not recommended.public boolean isEmpty()
ChildReferences
size() == 0
but may be
faster.isEmpty
in interface ChildReferences
public ChildReference getChild(Name name)
ChildReferences
getChild
in interface ChildReferences
name
- the name for the nodepublic ChildReference getChild(Path.Segment segment)
ChildReferences
getChild
in interface ChildReferences
segment
- the path segment, which defines the name and SNS indexpublic ChildReference getChild(Name name, int snsIndex)
ChildReferences
getChild
in interface ChildReferences
name
- the name for the nodesnsIndex
- the same-name-sibling index; must be positivepublic Iterator<ChildReference> iterator(Name name)
ChildReferences
iterator
in interface ChildReferences
name
- the name of the same-name-sibling nodes; may not be nullpublic Iterator<ChildReference> iterator()
ChildReferences
iterator
in interface Iterable<ChildReference>
iterator
in interface ChildReferences
public Iterator<ChildReference> iterator(Name name, ChildReferences.Context context)
ChildReferences
iterator
in interface ChildReferences
name
- the name of the same-name-sibling nodes; may not be nullcontext
- the context in which the child should be evaluated; may be null if there is no contextpublic Iterator<ChildReference> iterator(ChildReferences.Context context)
iterator
in interface ChildReferences
context
- the context in which the child should be evaluated; may be null if there is no contextprotected Iterator<ChildReference> contextSensitiveIterator(Iterator<ChildReference> original, ChildReferences.Context context)
public Iterator<ChildReference> iterator(Collection<?> namePatterns, NamespaceRegistry registry)
ChildReferences
names
(excluding same-name-sibling indexes)
matching at least one of the supplied patterns.iterator
in interface ChildReferences
namePatterns
- the list of string literals or regex patterns describing the namesregistry
- the namespace registry, used to convert names to a form compatible with the name patternspublic Iterator<ChildReference> iterator(ChildReferences.Context context, Collection<?> namePatterns, NamespaceRegistry registry)
ChildReferences
names
(excluding same-name-sibling indexes)
matching at least one of the supplied patterns, using the supplied context. The resulting iterator is lazy where possible,
but it may be an expensive call if there are large numbers of children.iterator
in interface ChildReferences
context
- the context in which the child should be evaluated; may be null if there is no contextnamePatterns
- the list of string literals or regex patterns describing the namesregistry
- the namespace registry, used to convert names to a form compatible with the name patternspublic Iterator<ChildReference> iterator(ChildReferences.Context context, Name name)
protected ChildReferences.Context defaultContext()
public abstract StringBuilder toString(StringBuilder sb)
Copyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.