java.lang.Object
org.refcodes.textual.MoreTextBuilder
- All Implemented Interfaces:
org.refcodes.mixin.ColumnWidthAccessor
,org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<MoreTextBuilder>
,org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthMutator
,org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthProperty
,Text<MoreTextBuilder>
,TextAccessor
,TextAccessor.TextBuilder<Text<MoreTextBuilder>>
,TextAccessor.TextMutator
,TextAccessor.TextProperty
,TextAccessor.TextProvider
public class MoreTextBuilder
extends Object
implements org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthProperty, org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<MoreTextBuilder>
A builder for processing a text with the given width applied and the given
MoreTextMode
applied.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.mixin.ColumnWidthAccessor
org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<B extends org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<B>>, org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthMutator, org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthProperty
Nested classes/interfaces inherited from interface org.refcodes.textual.TextAccessor
TextAccessor.TextBuilder<B extends TextAccessor.TextBuilder<B>>, TextAccessor.TextMutator, TextAccessor.TextProperty, TextAccessor.TextProvider
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String[]
asMoreText
(String[] aText, int aLength, String aMore, MoreTextMode aMoreTextMode) The text array is "mored" depending on the providedMoreTextMode
.static String[]
asMoreText
(String[] aText, int aLength, String aMore, MoreTextMode aMoreTextMode, boolean hasAnsiEscapeCodes) The text array is "mored" depending on the providedMoreTextMode
.static String
asMoreText
(String aText, int aLength, String aMore, MoreTextMode aMoreTextMode) The text is "mored" depending on the providedMoreTextMode
.static String
asMoreText
(String aText, int aLength, String aMore, MoreTextMode aMoreTextMode, boolean hasAnsiEscapeCodes) The text is "mored" depending on the providedMoreTextMode
.int
Retrieves the more text from the more text property.Retrieves the more text mode from the more text mode property.String[]
getText()
Retrieves the text from the text property.void
setColumnWidth
(int aColumnWidth) void
setMoreText
(String aMoreText) Sets the more text for the more text property.void
setMoreTextMode
(MoreTextMode aMoreTextMode) Sets the more text mode for the more text mode property.void
Sets the text for the text property.toString()
TheString
being build by the builder upon the settings of the attributes.Race condition safe shortcut for usingText.withText(String...)
followed byTextAccessor.TextProvider.toString()
.String[]
TheString
s being build by the builder upon the settings of the attributes.String[]
Race condition safe shortcut for usingText.withText(String...)
followed byTextAccessor.TextProvider.toStrings()
.withColumnWidth
(int aColumnWidth) withMoreText
(String aMoreText) Sets the more text for the more text property.withMoreTextMode
(MoreTextMode aMoreTextMode) Sets the more text mode for the more text mode property.With text.withText
(Collection<String> aText) With text.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthProperty
letColumnWidth
Methods inherited from interface org.refcodes.textual.TextAccessor.TextMutator
setText
Methods inherited from interface org.refcodes.textual.TextAccessor.TextProperty
letText, letText
-
Constructor Details
-
MoreTextBuilder
public MoreTextBuilder()
-
-
Method Details
-
getMoreText
Retrieves the more text from the more text property.- Returns:
- The more text stored by the more text property.
-
setMoreText
Sets the more text for the more text property.- Parameters:
aMoreText
- The more text to be stored by the more text mode property.
-
getColumnWidth
public int getColumnWidth()- Specified by:
getColumnWidth
in interfaceorg.refcodes.mixin.ColumnWidthAccessor
-
setColumnWidth
public void setColumnWidth(int aColumnWidth) - Specified by:
setColumnWidth
in interfaceorg.refcodes.mixin.ColumnWidthAccessor.ColumnWidthMutator
-
withColumnWidth
- Specified by:
withColumnWidth
in interfaceorg.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<MoreTextBuilder>
-
getMoreTextMode
Retrieves the more text mode from the more text mode property.- Returns:
- The more text mode stored by the more text mode property.
-
setMoreTextMode
Sets the more text mode for the more text mode property.- Parameters:
aMoreTextMode
- The more text mode to be stored by the more text mode property.
-
toStrings
TheString
s being build by the builder upon the settings of the attributes.- Specified by:
toStrings
in interfaceTextAccessor.TextProvider
- Returns:
- The according resulting
String
array
-
toStrings
Race condition safe shortcut for usingText.withText(String...)
followed byTextAccessor.TextProvider.toStrings()
. Implementation requirements: This method must not(!) be implemented by callingText.withText(String...)
followed byTextAccessor.TextProvider.toStrings()
(do not change the text property) as this would not be thread safe!- Specified by:
toStrings
in interfaceText<MoreTextBuilder>
- Parameters:
aText
- The text to be processed.- Returns:
- The according resulting
String
array
-
withMoreTextMode
Sets the more text mode for the more text mode property.- Parameters:
aMoreTextMode
- the more text mode- Returns:
- The builder for applying multiple build operations.
-
withMoreText
Sets the more text for the more text property.- Parameters:
aMoreText
- the more text- Returns:
- The builder for applying multiple build operations.
-
toString
TheString
being build by the builder upon the settings of the attributes.- Specified by:
toString
in interfaceTextAccessor.TextProvider
- Returns:
- The according resulting
String
- Throws:
IllegalStateException
- Thrown in case more than one text line has been set via theText.withText(String...)
orTextAccessor.TextMutator.setText(String...)
methods.
-
asMoreText
public static String[] asMoreText(String[] aText, int aLength, String aMore, MoreTextMode aMoreTextMode) The text array is "mored" depending on the providedMoreTextMode
. It is assumed that the text does not contain any ANSI escape codes, elseasMoreText(String[], int, String, MoreTextMode, boolean)
In case it isMoreTextMode.NONE
, then the text is returned untouched. In case it isMoreTextMode.LEFT
, then the text is "mored" to the left. In case it isMoreTextMode.RIGHT
, then the text is "mored" the the right.- Parameters:
aText
- The text array to be truncated.aLength
- The length to be reached.aMore
- The text to be prepended to the left in case the text was longer than the required length.aMoreTextMode
- TheMoreTextMode
specifying on how to truncate the text.- Returns:
- The accordingly "mored" text array.
-
asMoreText
public static String[] asMoreText(String[] aText, int aLength, String aMore, MoreTextMode aMoreTextMode, boolean hasAnsiEscapeCodes) The text array is "mored" depending on the providedMoreTextMode
. In case it isMoreTextMode.NONE
, then the text is returned untouched. In case it isMoreTextMode.LEFT
, then the text is "mored" to the left. In case it isMoreTextMode.RIGHT
, then the text is "mored" the the right.- Parameters:
aText
- The text array to be truncated.aLength
- The length to be reached.aMore
- The text to be prepended to the left in case the text was longer than the required length.aMoreTextMode
- TheMoreTextMode
specifying on how to truncate the text.hasAnsiEscapeCodes
- Whether to take any (non printable) ANSI escape codes into account which would, when not being considered, cause wrong results.- Returns:
- The accordingly "mored" text array.
-
asMoreText
public static String asMoreText(String aText, int aLength, String aMore, MoreTextMode aMoreTextMode) The text is "mored" depending on the providedMoreTextMode
. It is assumed that the text does not contain any ANSI escape codes, elseasMoreText(String, int, String, MoreTextMode, boolean)
In case it isMoreTextMode.NONE
, then the text is returned untouched. In case it isMoreTextMode.LEFT
, then the text is "mored" to the left. In case it isMoreTextMode.RIGHT
, then the text is "mored" the the right.- Parameters:
aText
- The text array to be truncated.aLength
- The length to be reached.aMore
- The text to be prepended to the left in case the text was longer than the required length.aMoreTextMode
- TheMoreTextMode
specifying on how to truncate the text.- Returns:
- The accordingly "mored" text array.
-
asMoreText
public static String asMoreText(String aText, int aLength, String aMore, MoreTextMode aMoreTextMode, boolean hasAnsiEscapeCodes) The text is "mored" depending on the providedMoreTextMode
. In case it isMoreTextMode.NONE
, then the text is returned untouched. In case it isMoreTextMode.LEFT
, then the text is "mored" to the left. In case it isMoreTextMode.RIGHT
, then the text is "mored" the the right.- Parameters:
aText
- The text to be truncated.aLength
- The length to be reached.aMore
- The text to be prepended to the left in case the text was longer than the required length.aMoreTextMode
- TheMoreTextMode
specifying on how to truncate the text.hasAnsiEscapeCodes
- Whether to take any (non printable) ANSI escape codes into account which would, when not being considered, cause wrong results.- Returns:
- The accordingly "mored" text.
-
getText
Retrieves the text from the text property.- Specified by:
getText
in interfaceTextAccessor
- Returns:
- The text stored by the text property.
-
setText
Sets the text for the text property.- Specified by:
setText
in interfaceTextAccessor.TextMutator
- Parameters:
aText
- The text to be stored by the text property.
-
withText
With text. -
withText
With text.- Specified by:
withText
in interfaceTextAccessor.TextBuilder<B extends Text<B>>
- Parameters:
aText
- the text- Returns:
- the b
-
toString
Race condition safe shortcut for usingText.withText(String...)
followed byTextAccessor.TextProvider.toString()
. Implementation requirements: This method must not(!) be implemented by callingText.withText(String...)
followed byTextAccessor.TextProvider.toString()
(do not change the text property) as this would not be thread safe!
-