public abstract class FormatWordsString extends Object implements Operation<String>
| Modifier | Constructor and Description |
|---|---|
protected |
FormatWordsString(String separator) |
| Modifier and Type | Method and Description |
|---|---|
String |
execute(String source) |
protected void |
formatFirstCapitalAllLower(StringBuilder result,
String name)
Append to result the string provided, with first letter capitalized and all next in lower case
|
protected abstract void |
formatFirstWord(StringBuilder result,
String word,
boolean nextWordExists)
Concatenate the formatted word into the result builder
|
protected abstract void |
formatNextWord(StringBuilder result,
String word,
boolean nextWordExists)
Concatenate the formatted word into the result builder
|
protected abstract String |
prepare(String source)
Implement any pre-processing of the source string, before parsing it into words
|
protected FormatWordsString(String separator)
separator - not null, possibly empty string to use as a separator between the result wordspublic final String execute(String source) throws RuntimeException, IllegalArgumentException
execute in interface Function<String,String>source - not null string to parseRuntimeExceptionIllegalArgumentExceptionFunction.execute(java.lang.Object)protected abstract String prepare(String source)
source - the not-null string to formatprotected abstract void formatFirstWord(StringBuilder result, String word, boolean nextWordExists)
result - non null store of the produced word, result.lenght() = 0word - not null, not empty word of letters and digits, which is NOT the first word identified in the source stringnextWordExists - true, if there are more words to be formatted, false when this is the only word to formatprotected abstract void formatNextWord(StringBuilder result, String word, boolean nextWordExists)
result - non null store of the produced word, result.lenght() != 0word - not null, not empty word of letters and digits, which is the first word identified in the source stringnextWordExists - true, if there are more words to be formatted, false when this is the last word to formatprotected final void formatFirstCapitalAllLower(StringBuilder result, String name)
name - not null to capitalizeresult - not null result/output parameterCopyright © 2001–2018 MDA Tools. All rights reserved.