org.refcodes.mixin.TruncateModeAccessor
, org.refcodes.mixin.TruncateModeAccessor.TruncateModeBuilder<TruncateTextBuilder>
, org.refcodes.mixin.TruncateModeAccessor.TruncateModeMutator
, org.refcodes.mixin.TruncateModeAccessor.TruncateModeProperty
, Text<TruncateTextBuilder>
, TextAccessor
, TextAccessor.TextBuilder<TruncateTextBuilder>
, TextAccessor.TextMutator
, TextAccessor.TextProperty
, TextAccessor.TextProvider
public class TruncateTextBuilder extends Object implements Text<TruncateTextBuilder>, org.refcodes.mixin.TruncateModeAccessor.TruncateModeProperty, org.refcodes.mixin.TruncateModeAccessor.TruncateModeBuilder<TruncateTextBuilder>
TextAccessor.TextBuilder<B extends TextAccessor.TextBuilder<B>>, TextAccessor.TextMutator, TextAccessor.TextProperty, TextAccessor.TextProvider
org.refcodes.mixin.TruncateModeAccessor.TruncateModeBuilder<B extends org.refcodes.mixin.TruncateModeAccessor.TruncateModeBuilder<B>>, org.refcodes.mixin.TruncateModeAccessor.TruncateModeMutator, org.refcodes.mixin.TruncateModeAccessor.TruncateModeProperty
Constructor | Description |
---|---|
TruncateTextBuilder() |
Modifier and Type | Method | Description |
---|---|---|
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 . |
static String |
asTruncated(String aText,
org.refcodes.mixin.TruncateMode aTruncateTextMode,
char... aChars) |
Returns a new
String without the according leading and/or
trailing chars. |
static String |
asTruncatedLeft(String aText) |
Returns a new
String without the according leading whitespaces as
of CharSet.WHITE_SPACES . |
static String |
asTruncatedLeft(String aText,
char... aChars) |
Returns a new
String without the according leading chars. |
static String |
asTruncatedRight(String aText) |
Returns a new
String without the according trailing whitespaces
as of CharSet.WHITE_SPACES . |
static String |
asTruncatedRight(String aText,
char... aChars) |
Returns a new
String without the according trailing chars. |
protected static void |
doStrip(StringBuffer aStringBuffer,
char aChar) |
Removes all leading and trailing chars identical with specified char ch.
|
protected static void |
doStripLeft(StringBuffer aStringBuffer,
char aChar) |
Removes all leading chars identical with specified char.
|
protected static void |
doStripRight(StringBuffer aStringBuffer,
char aChar) |
Removes all rear chars identical with specified char ch.
|
String[] |
getText() |
Retrieves the text from the text property.
|
char[] |
getTruncateChars() |
Retrieves the truncate chars from the truncate chars property.
|
org.refcodes.mixin.TruncateMode |
getTruncateMode() |
Retrieves the truncate text mode from the truncate text mode property.
|
void |
setText(String... aText) |
Sets the text for the text property.
|
void |
setTruncateChars(char... aTruncateChars) |
Sets the truncate chars for the truncate chars property.
|
void |
setTruncateMode(org.refcodes.mixin.TruncateMode aTruncateTextMode) |
Sets the truncate text mode for the truncate text mode property.
|
String |
toString(String... aText) |
Race condition safe shortcut for using
Text.withText(String...)
followed by TextAccessor.TextProvider.toString() . |
String |
toString() |
The
String being build by the builder upon the settings of the
attributes. |
String[] |
toStrings() |
The
String s being build by the builder upon the settings of the
attributes. |
String[] |
toStrings(String... aText) |
Race condition safe shortcut for using
Text.withText(String...)
followed by TextAccessor.TextProvider.toStrings() . |
protected static String |
toStrip(String aText,
char[] aChars) |
Returns a new String without leading nor trailing chars.
|
TruncateTextBuilder |
withStripChars(char... aStripChars) |
Sets the truncate chars for the truncate chars property.
|
B |
withText(Collection<String> aText) |
With text.
|
TruncateTextBuilder |
withText(String... aTextLines) |
Sets the
String array for the text property. |
TruncateTextBuilder |
withTruncateMode(org.refcodes.mixin.TruncateMode aTruncateTextMode) |
Sets the truncate text mode for the truncate text mode property.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getText
withText
setText, setText
letText, letText
public org.refcodes.mixin.TruncateMode getTruncateMode()
getTruncateMode
in interface org.refcodes.mixin.TruncateModeAccessor
public void setTruncateMode(org.refcodes.mixin.TruncateMode aTruncateTextMode)
setTruncateMode
in interface org.refcodes.mixin.TruncateModeAccessor.TruncateModeMutator
aTruncateTextMode
- The truncate text mode to be stored by the
truncate text mode property.public char[] getTruncateChars()
public void setTruncateChars(char... aTruncateChars)
aTruncateChars
- The truncate chars to be stored by the text align
mode property.public String[] toStrings()
String
s being build by the builder upon the settings of the
attributes.toStrings
in interface TextAccessor.TextProvider
String
arraypublic String[] toStrings(String... aText)
Text.withText(String...)
followed by TextAccessor.TextProvider.toStrings()
. Implementation requirements: This
method must not(!) be implemented by calling Text.withText(String...)
followed by TextAccessor.TextProvider.toStrings()
(do not change the text property) as
this would not be thread safe!toStrings
in interface Text<TruncateTextBuilder>
aText
- The text to be processed.String
arraypublic TruncateTextBuilder withTruncateMode(org.refcodes.mixin.TruncateMode aTruncateTextMode)
withTruncateMode
in interface org.refcodes.mixin.TruncateModeAccessor.TruncateModeBuilder<TruncateTextBuilder>
aTruncateTextMode
- The truncate text mode to be stored by the
truncate text mode property.public TruncateTextBuilder withText(String... aTextLines)
String
array for the text property.withText
in interface Text<TruncateTextBuilder>
withText
in interface TextAccessor.TextBuilder<TruncateTextBuilder>
aTextLines
- The String
array be stored by the text
property.public TruncateTextBuilder withStripChars(char... aStripChars)
aStripChars
- The truncate chars to be stored by the text align mode
property.public String toString() throws IllegalStateException
String
being build by the builder upon the settings of the
attributes.toString
in interface TextAccessor.TextProvider
String
IllegalStateException
- Thrown in case more than one text line has
been set via the withText(String...)
or
setText(String...)
methods.public static String asTruncated(String aText, org.refcodes.mixin.TruncateMode aTruncateTextMode)
String
without the according leading and/or
trailing whitespaces as of CharSet.WHITE_SPACES
.aText
- The text to truncate.aTruncateTextMode
- The TruncateMode
describes how to
truncate (left, right or both).String
.public static String asTruncated(String aText, org.refcodes.mixin.TruncateMode aTruncateTextMode, char... aChars)
String
without the according leading and/or
trailing chars.aText
- The text to truncate.aTruncateTextMode
- The TruncateMode
describes how to
truncate (left, right or both).aChars
- the chars to detect when truncating.String
.public static String asTruncatedLeft(String aText)
String
without the according leading whitespaces as
of CharSet.WHITE_SPACES
.aText
- The text to truncate.String
.public static String asTruncatedLeft(String aText, char... aChars)
String
without the according leading chars.aText
- The text to be stripped.aChars
- the charspublic static String asTruncatedRight(String aText)
String
without the according trailing whitespaces
as of CharSet.WHITE_SPACES
.aText
- The text to truncate.String
.public static String asTruncatedRight(String aText, char... aChars)
String
without the according trailing chars.aText
- The text to truncate.aChars
- the chars to detect when truncating.String
.protected static void doStripLeft(StringBuffer aStringBuffer, char aChar)
String
will be BBBAAABBB.aStringBuffer
- StringBuffer to modify.aChar
- Char to remove.protected static void doStripRight(StringBuffer aStringBuffer, char aChar)
aStringBuffer
- StringBuffer to modify.aChar
- Char to remove.protected static void doStrip(StringBuffer aStringBuffer, char aChar)
aStringBuffer
- StringBuffer to modify.aChar
- Char to remove.protected static String toStrip(String aText, char[] aChars)
aText
- The text to be stripped.aChars
- the charspublic String[] getText()
getText
in interface TextAccessor
public void setText(String... aText)
setText
in interface TextAccessor.TextMutator
aText
- The text to be stored by the text property.public B withText(Collection<String> aText)
withText
in interface TextAccessor.TextBuilder<B extends Text<B>>
aText
- the textpublic String toString(String... aText)
Text.withText(String...)
followed by TextAccessor.TextProvider.toString()
. Implementation requirements: This method
must not(!) be implemented by calling Text.withText(String...)
followed by TextAccessor.TextProvider.toString()
(do not change the text property) as this
would not be thread safe!Copyright © 2021. All rights reserved.