Class StringFormatValidator
java.lang.Object
org.jboss.logging.processor.validation.AbstractFormatValidator
org.jboss.logging.processor.validation.StringFormatValidator
- All Implemented Interfaces:
FormatValidator
A string format representation.
Date: 13.06.2011
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate final Stringprivate final Set<FormatPart> private final Set<StringFormatPart> static final PatternThe Regex pattern.private boolean -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateStringFormatValidator(String format) Private constructor for the singleton pattern. -
Method Summary
Modifier and TypeMethodDescriptionintThe number of arguments needed for the format.asFormat()Recreates the format using the internal formatting descriptors.private static voidChecks text to make sure we don't have extra garbage.format()Returns the format string used for validation.private static <K,V extends Comparable<? super V>>
Set<V> private voidinit()Initialize the string format.booleanisValid()Returnstrueof the format is valid, otherwisefalse.static StringFormatValidatorCreates a string format.static StringFormatValidatorCreates a string format.(package private) static List<StringFormatPart> sortParts(Collection<StringFormatPart> parts) toString()private voidvalidate()Validatesprivate voidstatic StringFormatValidatorwithTranslation(String format, String translationFormat) Creates a string format.Methods inherited from class org.jboss.logging.processor.validation.AbstractFormatValidator
detailMessage, setDetailMessage, setDetailMessage, setSummaryMessage, setSummaryMessage, summaryMessage
-
Field Details
-
PATTERN
The Regex pattern. -
formatParts
-
formats
-
argumentCount
private int argumentCount -
valid
private boolean valid -
format
-
-
Constructor Details
-
StringFormatValidator
Private constructor for the singleton pattern.- Parameters:
format- the format.
-
-
Method Details
-
of
Creates a string format.- Parameters:
format- the format.- Returns:
- the string format.
-
withTranslation
Creates a string format. Note: The validator returned is the validator for the translation format.- Parameters:
format- the format.translationFormat- the format of the translation- Returns:
- the string format.
-
of
Creates a string format.- Parameters:
format- the format.parameters- the parameters to validate against.- Returns:
- the string format.
-
sortParts
-
validate
private void validate()Validates -
validate
-
argumentCount
public int argumentCount()Description copied from interface:FormatValidatorThe number of arguments needed for the format.- Returns:
- the number of arguments needed.
-
format
Description copied from interface:FormatValidatorReturns the format string used for validation.- Returns:
- the format string.
-
isValid
public boolean isValid()Description copied from interface:FormatValidatorReturnstrueof the format is valid, otherwisefalse.- Returns:
trueof the format is valid, otherwisefalse.
-
asFormat
Recreates the format using the internal formatting descriptors.- Returns:
- the format.
-
toString
-
init
private void init()Initialize the string format. -
checkText
Checks text to make sure we don't have extra garbage.- Parameters:
text- the text to check.
-
getOrAdd
-