Package org.apache.sis.metadata
Class TreeNode.CollectionElement
java.lang.Object
org.apache.sis.metadata.TreeNode
org.apache.sis.metadata.TreeNode.Element
org.apache.sis.metadata.TreeNode.CollectionElement
- All Implemented Interfaces:
TreeTable.Node
- Enclosing class:
- TreeNode
A node for an element in a collection. This class needs the iteration order to be stable.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.sis.metadata.TreeNode
TreeNode.CollectionElement, TreeNode.Element
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final int
Index of the element in the collection, in iteration order.Fields inherited from class org.apache.sis.metadata.TreeNode.Element
decorator
Fields inherited from class org.apache.sis.metadata.TreeNode
baseType, cachedValue, metadata, table
-
Constructor Summary
ConstructorsConstructorDescriptionCollectionElement
(TreeNode parent, Object metadata, PropertyAccessor accessor, int indexInData, int indexInList) Creates a new node for the given collection element. -
Method Summary
Modifier and TypeMethodDescription(package private) void
appendIdentifier
(StringBuilder buffer) Appends an identifier for this node in the given buffer, forTreeNode.toString()
implementation.boolean
Returnstrue
if the value returned bygetUserObject()
should be the same for both nodes.(package private) Integer
getIndex()
Returns the zero-based index of this node in the metadata property.(package private) CharSequence
getName()
Appends the index of this property, if there is more than one.Fetches the property value from the metadata object, which is expected to be a collection, then fetch the element at the index represented by this node.int
hashCode()
Returns a hash code value for this node.(package private) void
setUserObject
(Object value) Sets the property value for this node.Methods inherited from class org.apache.sis.metadata.TreeNode.Element
getIdentifier, getRemarks, isWritable
Methods inherited from class org.apache.sis.metadata.TreeNode
appendStringTo, getChildren, getParent, getValue, isEditable, isLeaf, isMetadata, newChild, setValue, toString
-
Field Details
-
indexInList
final int indexInListIndex of the element in the collection, in iteration order.
-
-
Constructor Details
-
CollectionElement
CollectionElement(TreeNode parent, Object metadata, PropertyAccessor accessor, int indexInData, int indexInList) Creates a new node for the given collection element.- Parameters:
parent
- the parent of this node.metadata
- the metadata object for which this node will be a value.accessor
- accessor to use for fetching the name, type and collection.indexInData
- index to be given to the accessor of fetching the collection.indexInList
- index of the element in the collection, in iteration order.
-
-
Method Details
-
appendIdentifier
Appends an identifier for this node in the given buffer, forTreeNode.toString()
implementation.- Overrides:
appendIdentifier
in classTreeNode.Element
-
getIndex
Integer getIndex()Returns the zero-based index of this node in the metadata property. -
getName
CharSequence getName()Appends the index of this property, if there is more than one. Index numbering begins at 1, since this name if for human reading.- Overrides:
getName
in classTreeNode.Element
-
getUserObject
Fetches the property value from the metadata object, which is expected to be a collection, then fetch the element at the index represented by this node.- Specified by:
getUserObject
in interfaceTreeTable.Node
- Overrides:
getUserObject
in classTreeNode.Element
- Returns:
- any object stored at this node by the user, or
null
if none.
-
setUserObject
Sets the property value for this node.- Overrides:
setUserObject
in classTreeNode.Element
-
equals
Returnstrue
if the value returned bygetUserObject()
should be the same for both nodes.- Specified by:
equals
in interfaceTreeTable.Node
- Overrides:
equals
in classTreeNode.Element
- Parameters:
other
- the other object to compare with this node.- Returns:
- whether the two objects are nodes with equal values and equal children, ignoring parents.
-
hashCode
public int hashCode()Returns a hash code value for this node.- Specified by:
hashCode
in interfaceTreeTable.Node
- Overrides:
hashCode
in classTreeNode.Element
- Returns:
- a hash code for this node, potentially based on values and children but ignoring parent.
-