java.lang.Object
org.refcodes.textual.OverwriteTextBuilder
- All Implemented Interfaces:
Text<OverwriteTextBuilder>,TextAccessor,TextAccessor.TextBuilder<Text<OverwriteTextBuilder>>,TextAccessor.TextMutator,TextAccessor.TextProperty,TextAccessor.TextProvider
Overwrites a text with another one to the the right or to the left.
-
Nested Class Summary
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringasOverwriteLeft(String aText, String aWriteOverText) Overwrites a text starting at the left hand side with the given "overwriting" text.static StringasOverwriteRight(String aText, String aWriteOverText) Overwrites a text starting at the right hand side with the given "overwriting" text.static StringasOverwriteText(String aText, String aWriteOverText, OverwriteTextMode aOverwriteTextMode) To overwrite.Retrieves the overwrite text mode from the overwrite text mode property.Retrieves the overwriting text from the overwriting text property.String[]getText()Retrieves the text from the text property.voidsetOverwritingText(String aOverwritingText) Sets the overwriting text for the overwriting text property.voidSets the text for the text property.voidsetTextOverwriteMode(OverwriteTextMode aTextOverwriteMode) Sets the overwrite text mode for the overwrite text mode property.toString()TheStringbeing build by the builder upon the settings of the attributes.Race condition safe shortcut for usingText.withText(String...)followed byTextAccessor.TextProvider.toString().String[]TheStrings being build by the builder upon the settings of the attributes.String[]Race condition safe shortcut for usingText.withText(String...)followed byTextAccessor.TextProvider.toStrings().withOverwriteTextMode(OverwriteTextMode aOverwriteTextMode) Sets the overwrite text mode for the overwrite text mode property.withOverwritingText(String aOverwritingText) Sets the overwriting text for the overwriting text 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, waitMethods inherited from interface org.refcodes.textual.TextAccessor.TextMutator
setTextMethods inherited from interface org.refcodes.textual.TextAccessor.TextProperty
letText, letText
-
Constructor Details
-
OverwriteTextBuilder
public OverwriteTextBuilder()
-
-
Method Details
-
getOverwritingText
Retrieves the overwriting text from the overwriting text property.- Returns:
- The overwriting text stored by the overwriting text property.
-
setOverwritingText
Sets the overwriting text for the overwriting text property.- Parameters:
aOverwritingText- The overwriting text to be stored by the overwriting text property.
-
getOverwriteTextMode
Retrieves the overwrite text mode from the overwrite text mode property.- Returns:
- The overwrite text mode stored by the overwrite text mode property.
-
setTextOverwriteMode
Sets the overwrite text mode for the overwrite text mode property.- Parameters:
aTextOverwriteMode- The overwrite text mode to be stored by the overwrite text mode property.
-
toStrings
TheStrings being build by the builder upon the settings of the attributes.- Returns:
- The according resulting
Stringarray
-
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!- Parameters:
aText- The text to be processed.- Returns:
- The according resulting
Stringarray
-
withOverwritingText
Sets the overwriting text for the overwriting text property.- Parameters:
aOverwritingText- The overwriting text to be stored by the overwriting text property.- Returns:
- The builder for applying multiple build operations.
-
withOverwriteTextMode
Sets the overwrite text mode for the overwrite text mode property.- Parameters:
aOverwriteTextMode- The overwrite text mode to be stored by the overwrite text mode property.- Returns:
- The builder for applying multiple build operations.
-
asOverwriteText
public static String asOverwriteText(String aText, String aWriteOverText, OverwriteTextMode aOverwriteTextMode) To overwrite.- Parameters:
aText- the textaWriteOverText- the write over textaOverwriteTextMode- the overwrite text mode- Returns:
- the string
-
asOverwriteLeft
Overwrites a text starting at the left hand side with the given "overwriting" text.- Parameters:
aText- The text to be overwritten.aWriteOverText- The text used for overwriting.- Returns:
- A
Stringoverwritten on the left hand side with the given "overwriting" text.
-
asOverwriteRight
Overwrites a text starting at the right hand side with the given "overwriting" text.- Parameters:
aText- The text to be overwritten.aWriteOverText- The text used for overwriting.- Returns:
- A
Stringoverwritten on the right hand side with the given "overwriting" text.
-
getText
Retrieves the text from the text property.- Specified by:
getTextin interfaceTextAccessor- Returns:
- The text stored by the text property.
-
setText
Sets the text for the text property.- Specified by:
setTextin interfaceTextAccessor.TextMutator- Parameters:
aText- The text to be stored by the text property.
-
withText
With text. -
withText
With text.- Specified by:
withTextin interfaceTextAccessor.TextBuilder<B extends Text<B>>- Parameters:
aText- the text- Returns:
- the b
-
toString
TheStringbeing build by the builder upon the settings of the attributes. In case more then one line has been set as input and the functionality of the builder is applied to each line in separate, then this method returns all of them lines concatenated with a line break between each of them (implementation depended).- Specified by:
toStringin interfaceTextAccessor.TextProvider- Overrides:
toStringin classObject- Returns:
- The according resulting
String
-
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!
-