Class PolyString

    • Field Detail

      • F_ORIG

        public static final ItemName F_ORIG
      • F_NORM

        public static final ItemName F_NORM
      • F_TRANSLATION

        public static final ItemName F_TRANSLATION
      • F_TRANSLATION_LOCAL_PART

        public static final String F_TRANSLATION_LOCAL_PART
      • F_LANG

        public static final ItemName F_LANG
      • F_LANG_LOCAL_PART

        public static final String F_LANG_LOCAL_PART
    • Method Detail

      • getOrig

        public String getOrig()
      • setComputedOrig

        public void setComputedOrig​(String computedOrig)
        Used to set computed values of orig, e.g. in cases of translation. Not very clean.
      • getNorm

        public String getNorm()
      • setTranslation

        @Experimental
        public void setTranslation​(PolyStringTranslationType translation)
        Do NOT rely on this method too much. It may disappear later, e.g. when we align PolyString and PolyString type and make PolyString really immutable.
      • setLang

        @Experimental
        public void setLang​(Map<String,​String> lang)
        Do NOT rely on this method too much. It may disappear later, e.g. when we align PolyString and PolyString type and make PolyString really immutable.
      • isEmpty

        public boolean isEmpty()
      • isNull

        public boolean isNull()
      • recompute

        public PolyString recompute()
        Recomputes normalized value with default normalizer and returns modified `this`.
      • isComputed

        public boolean isComputed()
      • length

        public int length()
      • substring

        public String substring​(int from,
                                int to)
      • startsWith

        public boolean startsWith​(String value)
        Helper function that checks whether this original string begins with the specified value.
        Parameters:
        value - the value
        Returns:
        the string
      • endsWith

        public boolean endsWith​(String value)
        Helper function that checks whether this original string ends with the specified value.
        Parameters:
        value - the value
        Returns:
        the string
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • shortDump

        public void shortDump​(StringBuilder sb)
        Description copied from interface: ShortDumpable
        Show the content of the object intended for diagnostics. This method is supposed to append a compact, human-readable output in a single line. Unlike toString() method, there is no requirement to identify the actual class or type of the object. It is assumed that the class/type will be obvious from the context in which the output is used.
        Specified by:
        shortDump in interface ShortDumpable
        Parameters:
        sb - StringBuilder to which to a compact one-line content of the object intended for diagnostics by system administrator should be appended.
      • getOrig

        public static String getOrig​(PolyString s)
        Returns orig value or null for the nullable input polystring.
      • getOrig

        public static String getOrig​(PolyStringType s)
        Returns orig value or null for the nullable input polystring.
      • getNorm

        public static String getNorm​(PolyString s)
        Returns norm value or null for the nullable input polystring.
      • getNorm

        public static String getNorm​(PolyStringType s)
        Returns norm value or null for the nullable input polystring.
      • isSimple

        public boolean isSimple()
        Returns true if the PolyString form contains only simple string. I.e. returns true if the polystring can be serialized in a simplified form of a single string. Returns true in case that there are language mutations, translation, etc.
      • fromOrig

        public static PolyString fromOrig​(String orig)
        Returns poly-string for the provided `orig` value with `norm` recomputed with default normalizer. If, for whatever reason, poly-string with only `orig` is needed, use the constructor with `orig` parameter. TODO: Recompute added in 4.7, check usages, remove useless recomputes outside and eventually remove this TODO.