Package org.refcodes.textual
Class OverwriteTextBuilderImpl
- java.lang.Object
-
- org.refcodes.textual.OverwriteTextBuilderImpl
-
- All Implemented Interfaces:
OverwriteTextBuilder
,Text<OverwriteTextBuilder>
,TextAccessor
,TextAccessor.TextBuilder<OverwriteTextBuilder>
,TextAccessor.TextMutator
,TextAccessor.TextProperty
,TextAccessor.TextProvider
public class OverwriteTextBuilderImpl extends java.lang.Object implements OverwriteTextBuilder
The Class OverwriteTextBuilderImpl.- Author:
- steiner
-
-
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 Constructor Description OverwriteTextBuilderImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description OverwriteTextMode
getOverwriteTextMode()
Retrieves the overwrite text mode from the overwrite text mode property.java.lang.String
getOverwritingText()
Retrieves the overwriting text from the overwriting text property.java.lang.String[]
getText()
Retrieves the text from the text property.void
setOverwritingText(java.lang.String aOverwritingText)
Sets the overwriting text for the overwriting text property.void
setText(java.lang.String... aText)
Sets the text for the text property.void
setTextOverwriteMode(OverwriteTextMode aOverwriteTextMode)
Sets the overwrite text mode for the overwrite text mode property.protected static java.lang.String
toOverwrite(java.lang.String aText, java.lang.String aWriteOverText, OverwriteTextMode aOverwriteTextMode)
To overwrite.protected static java.lang.String
toOverwriteLeft(java.lang.String aText, java.lang.String aWriteOverText)
Overwrites a text starting at the left hand side with the given "overwriting" text.protected static java.lang.String
toOverwriteRight(java.lang.String aText, java.lang.String aWriteOverText)
Overwrites a text starting at the right hand side with the given "overwriting" text.java.lang.String
toString()
TheString
being build by the builder upon the settings of the attributes.java.lang.String
toString(java.lang.String... aText)
Race condition safe shortcut for usingText.withText(String...)
followed byTextAccessor.TextProvider.toString()
.java.lang.String[]
toStrings()
TheString
s being build by the builder upon the settings of the attributes.java.lang.String[]
toStrings(java.lang.String... aText)
Race condition safe shortcut for usingText.withText(String...)
followed byTextAccessor.TextProvider.toStrings()
.B
withText(java.lang.String... aText)
With text.B
withText(java.util.Collection<java.lang.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.textual.OverwriteTextBuilder
withOverwriteTextMode, withOverwritingText
-
Methods inherited from interface org.refcodes.textual.TextAccessor
getText
-
Methods inherited from interface org.refcodes.textual.TextAccessor.TextBuilder
withText
-
Methods inherited from interface org.refcodes.textual.TextAccessor.TextMutator
setText, setText
-
Methods inherited from interface org.refcodes.textual.TextAccessor.TextProvider
toString
-
-
-
-
Method Detail
-
getOverwritingText
public java.lang.String getOverwritingText()
Retrieves the overwriting text from the overwriting text property.- Specified by:
getOverwritingText
in interfaceOverwriteTextBuilder
- Returns:
- The overwriting text stored by the overwriting text property.
-
setOverwritingText
public void setOverwritingText(java.lang.String aOverwritingText)
Sets the overwriting text for the overwriting text property.- Specified by:
setOverwritingText
in interfaceOverwriteTextBuilder
- Parameters:
aOverwritingText
- The overwriting text to be stored by the overwriting text property.
-
getOverwriteTextMode
public OverwriteTextMode getOverwriteTextMode()
Retrieves the overwrite text mode from the overwrite text mode property.- Specified by:
getOverwriteTextMode
in interfaceOverwriteTextBuilder
- Returns:
- The overwrite text mode stored by the overwrite text mode property.
-
setTextOverwriteMode
public void setTextOverwriteMode(OverwriteTextMode aOverwriteTextMode)
Sets the overwrite text mode for the overwrite text mode property.- Specified by:
setTextOverwriteMode
in interfaceOverwriteTextBuilder
- Parameters:
aOverwriteTextMode
- The overwrite text mode to be stored by the overwrite text mode property.
-
toStrings
public java.lang.String[] 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
public java.lang.String[] toStrings(java.lang.String... aText)
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<OverwriteTextBuilder>
- Parameters:
aText
- The text to be processed.- Returns:
- The according resulting
String
array
-
toOverwrite
protected static java.lang.String toOverwrite(java.lang.String aText, java.lang.String aWriteOverText, OverwriteTextMode aOverwriteTextMode)
To overwrite.- Parameters:
aText
- the textaWriteOverText
- the write over textaOverwriteTextMode
- the overwrite text mode- Returns:
- the string
-
toOverwriteLeft
protected static java.lang.String toOverwriteLeft(java.lang.String aText, java.lang.String aWriteOverText)
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
String
overwritten on the left hand side with the given "overwriting" text.
-
toOverwriteRight
protected static java.lang.String toOverwriteRight(java.lang.String aText, java.lang.String aWriteOverText)
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
String
overwritten on the right hand side with the given "overwriting" text.
-
getText
public java.lang.String[] getText()
Retrieves the text from the text property.- Specified by:
getText
in interfaceTextAccessor
- Returns:
- The text stored by the text property.
-
setText
public void setText(java.lang.String... aText)
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
public B withText(java.lang.String... aText)
With text.
-
withText
public B withText(java.util.Collection<java.lang.String> aText)
With text.- Specified by:
withText
in interfaceTextAccessor.TextBuilder<B extends Text<B>>
- Parameters:
aText
- the text- Returns:
- the b
-
toString
public java.lang.String toString()
TheString
being 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:
toString
in interfaceTextAccessor.TextProvider
- Overrides:
toString
in classjava.lang.Object
- Returns:
- The according resulting
String
-
toString
public java.lang.String toString(java.lang.String... aText)
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!
-
-