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 int
private final String
private final Set<FormatPart>
private final Set<StringFormatPart>
static final Pattern
The Regex pattern.private boolean
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
StringFormatValidator
(String format) Private constructor for the singleton pattern. -
Method Summary
Modifier and TypeMethodDescriptionint
The number of arguments needed for the format.asFormat()
Recreates the format using the internal formatting descriptors.private static void
Checks 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 void
init()
Initialize the string format.boolean
isValid()
Returnstrue
of the format is valid, otherwisefalse
.static StringFormatValidator
Creates a string format.static StringFormatValidator
Creates a string format.(package private) static List<StringFormatPart>
sortParts
(Collection<StringFormatPart> parts) toString()
private void
validate()
Validatesprivate void
static StringFormatValidator
withTranslation
(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:FormatValidator
The number of arguments needed for the format.- Returns:
- the number of arguments needed.
-
format
Description copied from interface:FormatValidator
Returns the format string used for validation.- Returns:
- the format string.
-
isValid
public boolean isValid()Description copied from interface:FormatValidator
Returnstrue
of the format is valid, otherwisefalse
.- Returns:
true
of 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
-