Package org.opensaml.core.xml.util
Class IndexedXMLObjectChildrenList<ElementType extends XMLObject>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<ElementType>
org.opensaml.core.xml.util.XMLObjectChildrenList<ElementType>
org.opensaml.core.xml.util.IndexedXMLObjectChildrenList<ElementType>
- Type Parameters:
ElementType
- the type of element added to the list
- All Implemented Interfaces:
Iterable<ElementType>
,Collection<ElementType>
,List<ElementType>
@NotThreadSafe
public class IndexedXMLObjectChildrenList<ElementType extends XMLObject>
extends XMLObjectChildrenList<ElementType>
A list which indexes XMLObjects by their schema type and element QName for quick retrival based on those items.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<QName,
List<ElementType>> Index of objects by type and name.Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor.IndexedXMLObjectChildrenList
(XMLObject parent, Collection<ElementType> col) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(int index, ElementType element) Adds the given XMLObject to this list.protected void
checkAndCreateIndex
(QName index) Check for the existence of an index for the specified QName and create it if it doesn't exist.void
clear()
Retrieves all the SAMLObjects that have given schema type or element name, or a null if no such objects exist.protected void
indexElement
(ElementType element) Indexes the given SAMLObject by type and element name.protected void
indexElement
(QName index, ElementType element) Indexes the given SAMLobject by the given index.remove
(int index) boolean
remove
(ElementType element) Removes a given element from the list and index.protected void
removeElementFromIndex
(ElementType element) Removes the given element from the schema type and element QName index.protected void
removeElementFromIndex
(QName index, ElementType element) Removes an object from the given index id.set
(int index, ElementType element) Replaces the XMLObject at the specified index with the given element.List<? extends ElementType>
Returns a view of the list that only contains elements stored under the given index.Methods inherited from class org.opensaml.core.xml.util.XMLObjectChildrenList
contains, get, setParent, size
Methods inherited from class java.util.AbstractList
add, addAll, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
Field Details
-
objectIndex
Index of objects by type and name.
-
-
Constructor Details
-
IndexedXMLObjectChildrenList
Constructor.- Parameters:
parent
- the parent of theXMLObject
s added to the list
-
IndexedXMLObjectChildrenList
public IndexedXMLObjectChildrenList(@Nonnull XMLObject parent, @Nonnull Collection<ElementType> col) Constructor.- Parameters:
parent
- the parent of all elementscol
- collection to add to this list
-
-
Method Details
-
add
Adds the given XMLObject to this list. A null element is ignored, as is an element already in the list.An IllegalArgumentException is thrown if the given XMLObject already has a parent other than the parent given at list construction time.
- Specified by:
add
in interfaceList<ElementType extends XMLObject>
- Overrides:
add
in classXMLObjectChildrenList<ElementType extends XMLObject>
- Parameters:
index
- index at which to add the given XMLObjectelement
- element to be stored at the given index
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<ElementType extends XMLObject>
- Specified by:
clear
in interfaceList<ElementType extends XMLObject>
- Overrides:
clear
in classAbstractList<ElementType extends XMLObject>
-
get
Retrieves all the SAMLObjects that have given schema type or element name, or a null if no such objects exist.- Parameters:
typeOrName
- the schema type or element name- Returns:
- list of SAMLObjects that have given schema type or element name or null
-
checkAndCreateIndex
Check for the existence of an index for the specified QName and create it if it doesn't exist.- Parameters:
index
- the index to check
-
indexElement
Indexes the given SAMLObject by type and element name. A null input is ignored.- Parameters:
element
- the SAMLObject to index
-
indexElement
Indexes the given SAMLobject by the given index.- Parameters:
index
- the index for the elementelement
- the element to be indexed
-
remove
Removes a given element from the list and index.- Overrides:
remove
in classXMLObjectChildrenList<ElementType extends XMLObject>
- Parameters:
element
- the element to be removed- Returns:
- true if the element was in the list and removed, false if not
-
remove
- Specified by:
remove
in interfaceList<ElementType extends XMLObject>
- Overrides:
remove
in classXMLObjectChildrenList<ElementType extends XMLObject>
-
removeElementFromIndex
Removes the given element from the schema type and element QName index. A null input is ignored.- Parameters:
element
- the element to remove from the index
-
removeElementFromIndex
Removes an object from the given index id.- Parameters:
index
- the id of the indexelement
- the element to be removed from that index
-
set
Replaces the XMLObject at the specified index with the given element. A null input is ignored and returned.An IllegalArgumentException is thrown if the given XMLObject already has a parent other than the parent given at list construction time.
- Specified by:
set
in interfaceList<ElementType extends XMLObject>
- Overrides:
set
in classXMLObjectChildrenList<ElementType extends XMLObject>
- Parameters:
index
- index of the XMLObject to be replacedelement
- element to be stored at the given index- Returns:
- the replaced XMLObject
-
subList
Returns a view of the list that only contains elements stored under the given index. The returned list is backed by this list and supports all optional operations, so changes made to the returned list are reflected in this list.- Parameters:
index
- index of the elements returned in the list view- Returns:
- a view of this list that contains only the elements stored under the given index
-