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 Details

    • type

      private final org.opengis.util.CodeList<?> type
      The type of telephone number. Either UnsupportedCodeList.VOICE or UnsupportedCodeList.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

      protected org.opengis.metadata.citation.Telephone wrap(String value)
      Wraps the given telephone number in a new DefaultTelephone instance.
      Specified by:
      wrap in class LegacyPropertyAdapter<String,org.opengis.metadata.citation.Telephone>
      Parameters:
      value - the legacy value.
      Returns:
      the new type.
    • unwrap

      protected String unwrap(org.opengis.metadata.citation.Telephone container)
      Extracts the telephone number from the given DefaultTelephone instance.
      Specified by:
      unwrap in class LegacyPropertyAdapter<String,org.opengis.metadata.citation.Telephone>
      Parameters:
      container - the new type.
      Returns:
      the legacy value, or null.
    • update

      protected boolean update(org.opengis.metadata.citation.Telephone container, String value)
      Updates the telephone number in an existing DefaultTelephone instance, if possible.
      Specified by:
      update in class LegacyPropertyAdapter<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

      public boolean add(String value)
      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 because DefaultTelephone.getOwner() initialize new collections as collection containing DefaultTelephone.this.
      Specified by:
      add in interface Collection<String>
      Overrides:
      add in class LegacyPropertyAdapter<String,org.opengis.metadata.citation.Telephone>
      Parameters:
      value - the telephone number to add.
      Returns:
      true if the element has been added.