Class TruncateTextBuilder

    • Constructor Detail

      • TruncateTextBuilder

        public TruncateTextBuilder()
    • Method Detail

      • getTruncateMode

        public org.refcodes.mixin.TruncateMode getTruncateMode()
        Retrieves the truncate text mode from the truncate text mode property.
        Specified by:
        getTruncateMode in interface org.refcodes.mixin.TruncateModeAccessor
        Returns:
        The truncate text mode stored by the truncate text mode property.
      • setTruncateMode

        public void setTruncateMode​(org.refcodes.mixin.TruncateMode aTruncateTextMode)
        Sets the truncate text mode for the truncate text mode property.
        Specified by:
        setTruncateMode in interface org.refcodes.mixin.TruncateModeAccessor.TruncateModeMutator
        Parameters:
        aTruncateTextMode - The truncate text mode to be stored by the truncate text mode property.
      • getTruncateChars

        public char[] getTruncateChars()
        Retrieves the truncate chars from the truncate chars property.
        Returns:
        The truncate chars stored by the truncate chars property.
      • setTruncateChars

        public void setTruncateChars​(char... aTruncateChars)
        Sets the truncate chars for the truncate chars property.
        Parameters:
        aTruncateChars - The truncate chars to be stored by the text align mode property.
      • withTruncateMode

        public TruncateTextBuilder withTruncateMode​(org.refcodes.mixin.TruncateMode aTruncateTextMode)
        Sets the truncate text mode for the truncate text mode property.
        Specified by:
        withTruncateMode in interface org.refcodes.mixin.TruncateModeAccessor.TruncateModeBuilder<TruncateTextBuilder>
        Parameters:
        aTruncateTextMode - The truncate text mode to be stored by the truncate text mode property.
        Returns:
        The builder for applying multiple build operations.
      • withStripChars

        public TruncateTextBuilder withStripChars​(char... aStripChars)
        Sets the truncate chars for the truncate chars property.
        Parameters:
        aStripChars - The truncate chars to be stored by the text align mode property.
        Returns:
        The builder for applying multiple build operations.
      • asTruncated

        public static String asTruncated​(String aText,
                                         org.refcodes.mixin.TruncateMode aTruncateTextMode)
        Returns a new String without the according leading and/or trailing whitespaces as of CharSet.WHITE_SPACES.
        Parameters:
        aText - The text to truncate.
        aTruncateTextMode - The TruncateMode describes how to truncate (left, right or both).
        Returns:
        The accordingly truncated String.
      • asTruncated

        public static String asTruncated​(String aText,
                                         org.refcodes.mixin.TruncateMode aTruncateTextMode,
                                         char... aChars)
        Returns a new String without the according leading and/or trailing chars.
        Parameters:
        aText - The text to truncate.
        aTruncateTextMode - The TruncateMode describes how to truncate (left, right or both).
        aChars - the chars to detect when truncating.
        Returns:
        The accordingly truncated String.
      • asTruncatedLeft

        public static String asTruncatedLeft​(String aText)
        Returns a new String without the according leading whitespaces as of CharSet.WHITE_SPACES.
        Parameters:
        aText - The text to truncate.
        Returns:
        The accordingly truncated String.
      • asTruncatedLeft

        public static String asTruncatedLeft​(String aText,
                                             char... aChars)
        Returns a new String without the according leading chars.
        Parameters:
        aText - The text to be stripped.
        aChars - the chars
        Returns:
        The stripped text.
      • asTruncatedRight

        public static String asTruncatedRight​(String aText)
        Returns a new String without the according trailing whitespaces as of CharSet.WHITE_SPACES.
        Parameters:
        aText - The text to truncate.
        Returns:
        The accordingly truncated String.
      • asTruncatedRight

        public static String asTruncatedRight​(String aText,
                                              char... aChars)
        Returns a new String without the according trailing chars.
        Parameters:
        aText - The text to truncate.
        aChars - the chars to detect when truncating.
        Returns:
        The accordingly truncated String.
      • doStripLeft

        protected static void doStripLeft​(StringBuffer aStringBuffer,
                                          char aChar)
        Removes all leading chars identical with specified char. E.g. if str=AAABBBAAABBB and ch=A the returned String will be BBBAAABBB.
        Parameters:
        aStringBuffer - StringBuffer to modify.
        aChar - Char to remove.
      • doStripRight

        protected static void doStripRight​(StringBuffer aStringBuffer,
                                           char aChar)
        Removes all rear chars identical with specified char ch. E.g. if str=AAABBBAAABBB and ch=B str will become AAABBBAAA.
        Parameters:
        aStringBuffer - StringBuffer to modify.
        aChar - Char to remove.
      • doStrip

        protected static void doStrip​(StringBuffer aStringBuffer,
                                      char aChar)
        Removes all leading and trailing chars identical with specified char ch. E.g. if str=BAABBBAAABBB and ch=B str will become AABBBAAA.
        Parameters:
        aStringBuffer - StringBuffer to modify.
        aChar - Char to remove.
      • toStrip

        protected static String toStrip​(String aText,
                                        char[] aChars)
        Returns a new String without leading nor trailing chars.
        Parameters:
        aText - The text to be stripped.
        aChars - the chars
        Returns:
        The stripped text.
      • getText

        public String[] getText()
        Retrieves the text from the text property.
        Specified by:
        getText in interface TextAccessor
        Returns:
        The text stored by the text property.
      • setText

        public void setText​(String... aText)
        Sets the text for the text property.
        Specified by:
        setText in interface TextAccessor.TextMutator
        Parameters:
        aText - The text to be stored by the text property.