Package org.apache.sis.internal.jaxb
Class ModifiableIdentifierMap
java.lang.Object
java.util.AbstractMap<org.opengis.metadata.citation.Citation,String>
org.apache.sis.internal.jaxb.IdentifierMapAdapter
org.apache.sis.internal.jaxb.ModifiableIdentifierMap
- All Implemented Interfaces:
Serializable,Map<org.opengis.metadata.citation.Citation,,String> IdentifierMap
A map of identifiers which support
put and remove operations.
Thread safety
This class is thread safe if the underlying identifier collection is thread safe.- Since:
- 0.7
- Version:
- 0.7
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final longFor cross-version compatibility.Fields inherited from class org.apache.sis.internal.jaxb.IdentifierMapAdapter
EMPTY, identifiers -
Constructor Summary
ConstructorsConstructorDescriptionModifiableIdentifierMap(Collection<org.opengis.metadata.Identifier> identifiers) Creates a new map which will be a view over the given identifiers. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Removes every entries in the underlying collection.(package private) final booleanReturnstruesince this map supportputandremoveoperations.Sets the code of the identifier having the given authority to the given value.<T> TputSpecialized(IdentifierSpace<T> authority, T value) Sets the identifier associated with the given authority, and returns the previous value.Removes all identifiers associated with the given authority.private URISets thexlink:hrefvalue, which may be null.private <T> Tstore(IdentifierSpace<T> authority, T value) Sets the identifier associated with the given authority, without processing for special cases.Methods inherited from class org.apache.sis.internal.jaxb.IdentifierMapAdapter
containsKey, containsValue, entrySet, get, getIdentifier, getIdentifiers, getSpecialized, isEmpty, size, specialCase, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, keySet, merge, putAll, putIfAbsent, remove, replace, replace, replaceAll, values
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
-
Constructor Details
-
ModifiableIdentifierMap
Creates a new map which will be a view over the given identifiers.- Parameters:
identifiers- the identifiers to wrap in a map view.
-
-
Method Details
-
setHRef
Sets thexlink:hrefvalue, which may be null. If an explicitxlink:hrefidentifier exists, then it will removed before to set the newhrefin theXLinkobject. The intent is to give precedence to theXLink.getHRef()property in every cases where thehrefis parsable as aURI, and use the value associated to theHREFkey only as a fallback when the string cannot be parsed.- Parameters:
href- the new value, ornullfor removing the value.- Returns:
- the previous value, or
nullif none. - See Also:
-
isModifiable
final boolean isModifiable()Returnstruesince this map supportputandremoveoperations.- Overrides:
isModifiablein classIdentifierMapAdapter
-
clear
public void clear()Removes every entries in the underlying collection.- Specified by:
clearin interfaceMap<org.opengis.metadata.citation.Citation,String> - Overrides:
clearin classIdentifierMapAdapter
-
remove
Removes all identifiers associated with the given authority. The default implementation delegates toput(Citation, String)with anullvalue.- Specified by:
removein interfaceMap<org.opengis.metadata.citation.Citation,String> - Overrides:
removein classIdentifierMapAdapter- Parameters:
authority- the authority to search, which should be an instance ofCitation.- Returns:
- the code of the identifier for the given authority, or
nullif none.
-
put
Sets the code of the identifier having the given authority to the given value. If no identifier is found for the given authority, a new one is created. If more than one identifier is found for the given authority, then all previous identifiers may be removed in order to ensure that the new entry will be the first entry, so it can be find by thegetmethod.If the given
authorityisHREFand if the given string is parsable as aURI, then this method will actually store the value as theXLink.getHRef()property of theXLinkassociated to theXLINKkey. Only if the given string cannot be parsed, then the value is stored as-is under theHREFkey.- Specified by:
putin interfaceMap<org.opengis.metadata.citation.Citation,String> - Overrides:
putin classIdentifierMapAdapter- Parameters:
authority- the authority for which to set the code.code- the new code for the given authority, ornullfor removing the entry.- Returns:
- the previous code for the given authority, or
nullif none.
-
putSpecialized
Sets the identifier associated with the given authority, and returns the previous value.If the given
authorityisHREF, then this method will actually store the value as theXLink.getHRef()property of theXLinkassociated to theXLINKkey. The previousHREFvalue, if any, is discarded.- Specified by:
putSpecializedin interfaceIdentifierMap- Overrides:
putSpecializedin classIdentifierMapAdapter- Type Parameters:
T- the identifier type.- Parameters:
authority- the namespace with which the given identifier is to be associated.value- the identifier to be associated with the given namespace.- Returns:
- the previous identifier associated with
authority, ornullif there was no mapping of the specialized type forauthority.
-
store
Sets the identifier associated with the given authority, without processing for special cases.- Type Parameters:
T- the identifier type.- Parameters:
authority- the namespace with which the given identifier is to be associated.value- the identifier to be associated with the given namespace.- Returns:
- the previous identifier associated with
authority, ornullif there was no mapping of the specialized type forauthority.
-