org.apache.sis.metadata.iso.identification

## Class DefaultKeywords

- Object
- - AbstractMetadata
  - - ModifiableMetadata
    - - ISOMetadata
      - - DefaultKeywords

- All Implemented Interfaces:
    Serializable, Cloneable, Emptiable, LenientComparable, IdentifiedObject, Keywords

      public class DefaultKeywords
      extends ISOMetadata
      implements Keywords

  Keywords, their type and reference source. The following property is mandatory in a well-formed metadata according ISO 19115:
  `MD_Keywords` `└─keyword……` Commonly used word(s) or formalised word(s) or phrase(s) used to describe the subject.

  Limitations:

  - Instances of this class are not synchronized for multi-threading. Synchronization, if needed, is caller's responsibility.
  - Serialized objects of this class are not guaranteed to be compatible with future Apache SIS releases. Serialization support is appropriate for short term storage or RMI between applications running the same version of Apache SIS. For long term storage, use `XML` instead.
  Since:
    0.3
  See Also:
    Serialized Form

  Defined in the `sis-metadata` module

- - ### Field Summary

    - ### Fields inherited from class ISOMetadata

      `identifiers`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultKeywords()` Constructs an initially empty keywords.
    `DefaultKeywords(CharSequence... keywords)` Creates keywords initialized to the given key word.
    `DefaultKeywords(Keywords object)` Constructs a new instance initialized with the values from the specified metadata object.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static DefaultKeywords` | `castOrCopy(Keywords object)` Returns a SIS metadata implementation with the values of the given arbitrary implementation.
    `CodeList<?>` | `getKeywordClass()` Returns the user-defined categorization of groups of keywords that extend or are orthogonal to the standardized keyword type codes.
    `Collection<InternationalString>` | `getKeywords()` Returns commonly used word(s) or formalised word(s) or phrase(s) used to describe the subject.
    `Citation` | `getThesaurusName()` Returns the name of the formally registered thesaurus or a similar authoritative source of keywords.
    `KeywordType` | `getType()` Returns the subject matter used to group similar keywords.
    `void` | `setKeywordClass(CodeList<?> newValue)` Sets the user-defined categorization of groups of keywords.
    `void` | `setKeywords(Collection<? extends InternationalString> newValues)` Sets commonly used word(s) or formalised word(s) or phrase(s) used to describe the subject.
    `void` | `setThesaurusName(Citation newValue)` Sets the name of the formally registered thesaurus or a similar authoritative source of keywords.
    `void` | `setType(KeywordType newValue)` Sets the subject matter used to group similar keywords.

    - ### Methods inherited from class ISOMetadata

      `freeze, getIdentifierMap, getIdentifiers, getStandard`

    - ### Methods inherited from class ModifiableMetadata

      `checkWritePermission, clone, collectionType, copyCollection, copyList, copySet, isModifiable, nonNullCollection, nonNullList, nonNullSet, singleton, unmodifiable, writeCollection, writeList, writeSet`

    - ### Methods inherited from class AbstractMetadata

      `asMap, asTreeTable, equals, equals, getInterface, hashCode, isEmpty, prune, toString`

    - ### Methods inherited from class Object

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### DefaultKeywords

          public DefaultKeywords()

      Constructs an initially empty keywords.

    - #### DefaultKeywords

          public DefaultKeywords(CharSequence... keywords)

      Creates keywords initialized to the given key word.
      Parameters:
        `keywords` - commonly used words or formalised words or phrases used to describe the subject, or `null` if none.

    - #### DefaultKeywords

          public DefaultKeywords(Keywords object)

      Constructs a new instance initialized with the values from the specified metadata object. This is a shallow copy constructor, since the other metadata contained in the given object are not recursively copied.
      Parameters:
        `object` - the metadata to copy values from, or `null` if none.
      See Also:
        `castOrCopy(Keywords)`

  - ### Method Detail

    - #### castOrCopy

          public static DefaultKeywords castOrCopy(Keywords object)

      Returns a SIS metadata implementation with the values of the given arbitrary implementation. This method performs the first applicable action in the following choices:
      - If the given object is `null`, then this method returns `null`.
      - Otherwise if the given object is already an instance of `DefaultKeywords`, then it is returned unchanged.
      - Otherwise a new `DefaultKeywords` instance is created using the copy constructor and returned. Note that this is a shallow copy operation, since the other metadata contained in the given object are not recursively copied.
      Parameters:
        `object` - the object to get as a SIS implementation, or `null` if none.
      Returns:
        a SIS implementation containing the values of the given object (may be the given object itself), or `null` if the argument was null.

    - #### getKeywords

          public Collection<InternationalString> getKeywords()

      Returns commonly used word(s) or formalised word(s) or phrase(s) used to describe the subject.
      Specified by:
        `getKeywords` in interface `Keywords`
      Returns:
        word(s) or phrase(s) used to describe the subject.

    - #### setKeywords

          public void setKeywords(Collection<? extends InternationalString> newValues)

      Sets commonly used word(s) or formalised word(s) or phrase(s) used to describe the subject.
      Parameters:
        `newValues` - the new keywords.

    - #### getType

          public KeywordType getType()

      Returns the subject matter used to group similar keywords.
      Specified by:
        `getType` in interface `Keywords`
      Returns:
        subject matter used to group similar keywords, or `null`.

    - #### setType

          public void setType(KeywordType newValue)

      Sets the subject matter used to group similar keywords.
      Parameters:
        `newValue` - the new keyword type.

    - #### getThesaurusName

          public Citation getThesaurusName()

      Returns the name of the formally registered thesaurus or a similar authoritative source of keywords.
      Specified by:
        `getThesaurusName` in interface `Keywords`
      Returns:
        name of registered thesaurus or similar authoritative source of keywords, or `null`.

    - #### setThesaurusName

          public void setThesaurusName(Citation newValue)

      Sets the name of the formally registered thesaurus or a similar authoritative source of keywords.
      Parameters:
        `newValue` - the new thesaurus name.

    - #### getKeywordClass

          @UML(identifier="keywordClass",
               obligation=OPTIONAL,
               specification=ISO_19115)
          public CodeList<?> getKeywordClass()

      Returns the user-defined categorization of groups of keywords that extend or are orthogonal to the standardized keyword type codes.
      Upcoming API change — specialization
      The element type will be changed to the `KeywordClass` code list when GeoAPI will provide it (tentatively in GeoAPI 3.1).
      Returns:
        user-defined categorization of groups of keywords, or `null` if none.
      Since:
        0.5

    - #### setKeywordClass

          public void setKeywordClass(CodeList<?> newValue)

      Sets the user-defined categorization of groups of keywords.
      Upcoming API change — specialization
      The argument type will be changed to the `KeywordClass` code list when GeoAPI will provide it (tentatively in GeoAPI 3.1). In the meantime, users can define their own code list class as below:

          final class UnsupportedCodeList extends CodeList<UnsupportedCodeList> {
              private static final List<UnsupportedCodeList> VALUES = new ArrayList<UnsupportedCodeList>();

              // Need to declare at least one code list element.
              public static final UnsupportedCodeList MY_CODE_LIST = new UnsupportedCodeList("MY_CODE_LIST");

              private UnsupportedCodeList(String name) {
                  super(name, VALUES);
              }

              public static UnsupportedCodeList valueOf(String code) {
                  return valueOf(UnsupportedCodeList.class, code);
              }

              @Override
              public UnsupportedCodeList[] family() {
                  synchronized (VALUES) {
                      return VALUES.toArray(new UnsupportedCodeList[VALUES.size()]);
                  }
              }
          }

      Parameters:
        `newValue` - new user-defined categorization of groups of keywords.
      Since:
        0.5

Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.