Class StringIntern

  • All Implemented Interfaces:
    java.io.Serializable

    public final class StringIntern
    extends java.lang.Object
    implements java.io.Serializable
    Internal String : factorize String to optimize heap usage. Can be removed thru a clear cache
    Reserved to common repository and core object's definitions, not for user's dynamic data
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static StringIntern EMPTY
      Empty string "" as a StringIntern
      static java.lang.String NO
      No "N" indexed value
      static StringIntern NULL
      Null as a StringIntern
      static java.lang.String YES
      Yes "Y" indexed value
      static StringIntern ZERO
      Zero string "0&qot; as a StringIntern
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void clear()
      Clear internal Strings
      int compareTo​(java.lang.Object a)
      Same as String.compareTo
      boolean equals​(java.lang.Object a)
      Check if value equals argument
      static StringIntern get​(java.lang.String value)
      Get the internalized String
      java.lang.String getValue()
      Get the value, same as toString
      static java.lang.String getValue​(StringIntern intern)
      Get the value of a string singleton
      static java.lang.String getValue​(java.lang.String value)
      Return the String singleton from any string
      int hashCode()
      Get hash code
      int indexOf​(char c)
      Same as String.indexOf
      int indexOf​(java.lang.String s)
      Same as String.indexOf
      int length()
      Same as String.length
      void setValue​(java.lang.String value)
      Set the value
      boolean startsWith​(java.lang.String prefix)
      Same as String.startsWith
      java.lang.String toString()
      Get value, same as getValue
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • NULL

        public static final StringIntern NULL
        Null as a StringIntern
      • EMPTY

        public static final StringIntern EMPTY
        Empty string "" as a StringIntern
      • ZERO

        public static final StringIntern ZERO
        Zero string "0&qot; as a StringIntern
      • YES

        public static final java.lang.String YES
        Yes "Y" indexed value
      • NO

        public static final java.lang.String NO
        No "N" indexed value
    • Method Detail

      • getValue

        public java.lang.String getValue()
        Get the value, same as toString
        Returns:
        Value
      • toString

        public java.lang.String toString()
        Get value, same as getValue
        Overrides:
        toString in class java.lang.Object
        Returns:
        Value
      • setValue

        public void setValue​(java.lang.String value)
        Set the value
        Parameters:
        value - Value
      • equals

        public boolean equals​(java.lang.Object a)
        Check if value equals argument
        Overrides:
        equals in class java.lang.Object
        Parameters:
        a - Argument
        Returns:
        True if equals
      • hashCode

        public int hashCode()
        Get hash code
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        Hash code
      • compareTo

        public int compareTo​(java.lang.Object a)
        Same as String.compareTo
        Returns:
        0 if equals, lt; 0 if inferior, > 0 if superior
      • startsWith

        public boolean startsWith​(java.lang.String prefix)
        Same as String.startsWith
        Parameters:
        prefix - Prefix
        Returns:
        True if starts with
      • indexOf

        public int indexOf​(java.lang.String s)
        Same as String.indexOf
        Parameters:
        s - String
        Returns:
        Indef of string or -1
      • indexOf

        public int indexOf​(char c)
        Same as String.indexOf
        Parameters:
        c - Chararcter
        Returns:
        Index of character or -1
      • length

        public int length()
        Same as String.length
        Returns:
        length
      • get

        public static StringIntern get​(java.lang.String value)
        Get the internalized String
        Parameters:
        value - Value to index
        Returns:
        StringIntern singleton equals to value
      • clear

        public static void clear()
        Clear internal Strings
      • getValue

        public static java.lang.String getValue​(java.lang.String value)
        Return the String singleton from any string
        Parameters:
        value - Value to index
        Returns:
        String singleton equals to value
      • getValue

        public static java.lang.String getValue​(StringIntern intern)
        Get the value of a string singleton
        Parameters:
        intern - Internalized string
        Returns:
        Value