Class NilInternationalString

java.lang.Object
org.apache.sis.xml.NilInternationalString
All Implemented Interfaces:
Serializable, CharSequence, Comparable<org.opengis.util.InternationalString>, NilObject, org.opengis.util.InternationalString

final class NilInternationalString extends Object implements org.opengis.util.InternationalString, NilObject, Serializable
An empty InternationalString which is nil for the given reason.
Since:
0.4
Version:
0.4
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      For cross-version compatibility.
      See Also:
    • reason

      private final NilReason reason
      The reason why the object is nil.
  • Constructor Details

    • NilInternationalString

      NilInternationalString(NilReason reason)
      Creates a new international string which is nil for the given reason.
  • Method Details

    • getNilReason

      public NilReason getNilReason()
      Returns the reason why this object is nil.
      Specified by:
      getNilReason in interface NilObject
      Returns:
      the reason why this object contains no information.
      See Also:
    • length

      public int length()
      Returns the length, which is always 0.
      Specified by:
      length in interface CharSequence
    • charAt

      public char charAt(int index)
      Unconditionally throws IndexOutOfBoundsException, since we cannot get any character from an empty string.
      Specified by:
      charAt in interface CharSequence
    • toString

      public String toString()
      Unconditionally returns en empty string.
      Specified by:
      toString in interface CharSequence
      Specified by:
      toString in interface org.opengis.util.InternationalString
      Overrides:
      toString in class Object
    • toString

      public String toString(Locale locale)
      Unconditionally returns en empty string.
      Specified by:
      toString in interface org.opengis.util.InternationalString
    • subSequence

      public CharSequence subSequence(int start, int end)
      Returns this if the range is [0…0], or throws an exception otherwise.
      Specified by:
      subSequence in interface CharSequence
    • compareTo

      public int compareTo(org.opengis.util.InternationalString other)
      Returns 0 if the other string is empty, or -1 otherwise.
      Specified by:
      compareTo in interface Comparable<org.opengis.util.InternationalString>
    • readResolve

      private Object readResolve() throws ObjectStreamException
      Invoked on deserialization for replacing the deserialized instance by the unique instance.
      Throws:
      ObjectStreamException