Class LegacyTelephones
java.lang.Object
java.util.AbstractCollection<String>
org.apache.sis.internal.metadata.legacy.LegacyPropertyAdapter<String,org.opengis.metadata.citation.Telephone>
org.apache.sis.metadata.iso.citation.LegacyTelephones
- All Implemented Interfaces:
Iterable<String>
,Collection<String>
final class LegacyTelephones
extends LegacyPropertyAdapter<String,org.opengis.metadata.citation.Telephone>
An adapter for converting telephone lists from ISO 19115:2014 definition to ISO 19115:2003 definition.
Used for implementation of deprecated
DefaultTelephone.getVoices()
and
DefaultTelephone.getFacsimiles()
methods.- Since:
- 0.5
- Version:
- 0.5
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.opengis.util.CodeList
<?> The type of telephone number.Fields inherited from class org.apache.sis.internal.metadata.legacy.LegacyPropertyAdapter
elements
-
Constructor Summary
ConstructorsConstructorDescriptionLegacyTelephones
(Collection<org.opengis.metadata.citation.Telephone> telephones, org.opengis.util.CodeList<?> type) Wraps the given telephone list for the given type. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Adds a new telephone number.protected String
unwrap
(org.opengis.metadata.citation.Telephone container) Extracts the telephone number from the givenDefaultTelephone
instance.protected boolean
Updates the telephone number in an existingDefaultTelephone
instance, if possible.protected org.opengis.metadata.citation.Telephone
Wraps the given telephone number in a newDefaultTelephone
instance.Methods inherited from class org.apache.sis.internal.metadata.legacy.LegacyPropertyAdapter
equals, getSingleton, hashCode, isEmpty, iterator, setValues, size, validOrNull, warnIgnoredExtraneous
Methods inherited from class java.util.AbstractCollection
addAll, clear, contains, containsAll, 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, spliterator, stream, toArray
-
Field Details
-
type
private final org.opengis.util.CodeList<?> typeThe type of telephone number. EitherUnsupportedCodeList.VOICE
orUnsupportedCodeList.FACSIMILE
.
-
-
Constructor Details
-
LegacyTelephones
LegacyTelephones(Collection<org.opengis.metadata.citation.Telephone> telephones, org.opengis.util.CodeList<?> type) Wraps the given telephone list for the given type.
-
-
Method Details
-
wrap
Wraps the given telephone number in a newDefaultTelephone
instance.- Specified by:
wrap
in classLegacyPropertyAdapter<String,
org.opengis.metadata.citation.Telephone> - Parameters:
value
- the legacy value.- Returns:
- the new type.
-
unwrap
Extracts the telephone number from the givenDefaultTelephone
instance.- Specified by:
unwrap
in classLegacyPropertyAdapter<String,
org.opengis.metadata.citation.Telephone> - Parameters:
container
- the new type.- Returns:
- the legacy value, or
null
.
-
update
Updates the telephone number in an existingDefaultTelephone
instance, if possible.- Specified by:
update
in classLegacyPropertyAdapter<String,
org.opengis.metadata.citation.Telephone> - Parameters:
container
- the new value to be used as a container for the old value.value
- the value to update in the container.- Returns:
- whether this method has been able to perform the update.
-
add
Adds a new telephone number. As a special case if the first element is empty, then the telephone number will be set in that element. We test only the first element becauseDefaultTelephone.getOwner()
initialize new collections as collection containingDefaultTelephone.this
.- Specified by:
add
in interfaceCollection<String>
- Overrides:
add
in classLegacyPropertyAdapter<String,
org.opengis.metadata.citation.Telephone> - Parameters:
value
- the telephone number to add.- Returns:
true
if the element has been added.
-