Class PT_FreeText

java.lang.Object
org.apache.sis.internal.jaxb.gco.GO_CharacterString
org.apache.sis.internal.jaxb.lan.PT_FreeText

public final class PT_FreeText extends GO_CharacterString
JAXB wrapper for ISO 19115-3 <PT_FreeText> element mapped to InternationalString. It will be used in order to marshal and unmarshal international strings localized in several language, using the DefaultInternationalString implementation class. Example: If there is more than one locale, the whole <lan:textGroup> block is repeated for each locale, instead of repeating <lan:LocalisedCharacterString> inside the same group as we could expect. However, at unmarshalling time, both forms are accepted.

The <gco:CharacterString> element is inherited from the GO_CharacterString parent class.

Since:
0.3
Version:
1.0
  • Field Details

    • textGroup

      private TextGroup[] textGroup
      A set of LocalisedCharacterString, representing the <lan:textGroup> element. The array shall contain one element for each locale.
  • Constructor Details

    • PT_FreeText

      private PT_FreeText()
      Empty constructor used only by JAXB.
    • PT_FreeText

      private PT_FreeText(String text, TextGroup[] textGroup)
      Constructs a PT_FreeText containing the given text groups.

      The <gco:CharacterString> element will typically be set for the Locale.ROOT, which is the "unlocalized" string (not the same thing than the string in the default locale). Note that the TextGroup constructor works better if the <gco:CharacterString> have been set for the ROOT locale (the default behavior). If a different locale were set, the list of localized strings in TextGroup may contains an element which duplicate the <gco:CharacterString> element, or the unlocalized string normally written in <gco:CharacterString> may be missing.

      Parameters:
      text - the text to write in the <gco:CharacterString> element.
      textGroup - the text group elements.
      See Also:
  • Method Details

    • create

      public static PT_FreeText create(org.opengis.util.InternationalString text)
      Constructs a text group from the given InternationalString if it contains at least one non-root locale. Otherwise returns null, meaning that the simpler GO_CharacterString construct should be used instead.
      Parameters:
      text - an international string which could have several translations embedded for the same text.
      Returns:
      a PT_FreeText instance if the given text has several translations, or null otherwise.
    • contains

      private boolean contains(String search)
      Returns true if this PT_FreeText contains the given localized text. This method searches only in the localized text. The content of the GO_CharacterString.text field is intentionally omitted since it is usually the text we are searching for! (this method is used for detecting duplicated values).
      Parameters:
      search - the text to search (usually the GO_CharacterString.text value).
      Returns:
      true if the given text has been found.
    • toCharSequence

      protected CharSequence toCharSequence()
      Returns the content of this <gco:CharacterString> as an InternationalString.
      Overrides:
      toCharSequence in class GO_CharacterString
      Returns:
      the character sequence for this <gco:CharacterString>.