Package org.apache.sis.referencing
Class AbstractIdentifiedObject.Names
java.lang.Object
java.util.AbstractCollection<org.opengis.referencing.ReferenceIdentifier>
org.apache.sis.referencing.AbstractIdentifiedObject.Names
- All Implemented Interfaces:
Iterable<org.opengis.referencing.ReferenceIdentifier>
,Collection<org.opengis.referencing.ReferenceIdentifier>
- Enclosing class:
AbstractIdentifiedObject
private final class AbstractIdentifiedObject.Names
extends AbstractCollection<org.opengis.referencing.ReferenceIdentifier>
A writable view over the name of the enclosing object followed
by all aliases which are instance of Why we do not use
It would be easier to define a
Identifier
.
Used by JAXB only at (un)marshalling time because GML merges the name and aliases in a single <gml:name>
property.
Why we do not use Identifier[]
array instead
It would be easier to define a getNames()
method returning all identifiers in an array, and let JAXB
invoke setNames(Identifier[])
at unmarshalling time. But methods expecting an array in argument are
invoked by JAXB only after the full element has been unmarshalled. For some AbstractIdentifiedObject
subclasses, this is too late. For example, DefaultOperationMethod
may need to know the operation name
before to parse the parameters.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
add
(org.opengis.referencing.ReferenceIdentifier id) Invoked by JAXB at unmarshalling time for each identifier.void
clear()
Invoked by JAXB before to write in the collection at unmarshalling time.Iterator
<org.opengis.referencing.ReferenceIdentifier> iterator()
Returns an iterator over the name and aliases that are instance ofIdentifier
.int
size()
Returns the number of name and aliases that are instance ofIdentifier
.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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
-
Constructor Details
-
Names
private Names()
-
-
Method Details
-
clear
public void clear()Invoked by JAXB before to write in the collection at unmarshalling time. Do nothing since our object is already empty.- Specified by:
clear
in interfaceCollection<org.opengis.referencing.ReferenceIdentifier>
- Overrides:
clear
in classAbstractCollection<org.opengis.referencing.ReferenceIdentifier>
-
size
public int size()Returns the number of name and aliases that are instance ofIdentifier
.- Specified by:
size
in interfaceCollection<org.opengis.referencing.ReferenceIdentifier>
- Specified by:
size
in classAbstractCollection<org.opengis.referencing.ReferenceIdentifier>
-
iterator
Returns an iterator over the name and aliases that are instance ofIdentifier
.- Specified by:
iterator
in interfaceCollection<org.opengis.referencing.ReferenceIdentifier>
- Specified by:
iterator
in interfaceIterable<org.opengis.referencing.ReferenceIdentifier>
- Specified by:
iterator
in classAbstractCollection<org.opengis.referencing.ReferenceIdentifier>
-
add
public boolean add(org.opengis.referencing.ReferenceIdentifier id) Invoked by JAXB at unmarshalling time for each identifier. The first identifier will be taken as the name and all other identifiers (if any) as aliases.Some (but not all) JAXB implementations never invoke setter method for collections. Instead, they invoke
AbstractIdentifiedObject.getNames()
and add directly the identifiers in the returned collection. Consequently, this method must writes directly in the enclosing object. See JAXB-488 for more information.- Specified by:
add
in interfaceCollection<org.opengis.referencing.ReferenceIdentifier>
- Overrides:
add
in classAbstractCollection<org.opengis.referencing.ReferenceIdentifier>
-