Class StringFormatValidator
- java.lang.Object
-
- org.jboss.logging.processor.validation.StringFormatValidator
-
- All Implemented Interfaces:
FormatValidator
public final class StringFormatValidator extends Object
A string format representation. Date: 13.06.2011- Author:
- James R. Perkins
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intargumentCount()The number of arguments needed for the format.StringasFormat()Recreates the format using the internal formatting descriptors.StringdetailMessage()A detail message ifFormatValidator.isValid()returnsfalse, otherwise an empty string.Stringformat()Returns the format string used for validation.booleanisValid()Returnstrueof the format is valid, otherwisefalse.static StringFormatValidatorof(String format)Creates a string format.static StringFormatValidatorof(String format, Object... parameters)Creates a string format.StringsummaryMessage()A summary message ifFormatValidator.isValid()returnsfalse, otherwise an empty string.StringtoString()static StringFormatValidatorwithTranslation(String format, String translationFormat)Creates a string format.
-
-
-
Field Detail
-
PATTERN
public static final Pattern PATTERN
The Regex pattern.
-
-
Method Detail
-
of
public static StringFormatValidator of(String format)
Creates a string format.- Parameters:
format- the format.- Returns:
- the string format.
-
withTranslation
public static StringFormatValidator withTranslation(String format, String translationFormat)
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
public static StringFormatValidator of(String format, Object... parameters)
Creates a string format.- Parameters:
format- the format.parameters- the parameters to validate against.- Returns:
- the string format.
-
argumentCount
public int argumentCount()
Description copied from interface:FormatValidatorThe number of arguments needed for the format.- Returns:
- the number of arguments needed.
-
format
public String 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
public String asFormat()
Recreates the format using the internal formatting descriptors.- Returns:
- the format.
-
detailMessage
public final String detailMessage()
Description copied from interface:FormatValidatorA detail message ifFormatValidator.isValid()returnsfalse, otherwise an empty string.- Specified by:
detailMessagein interfaceFormatValidator- Returns:
- a detailed message.
-
summaryMessage
public final String summaryMessage()
Description copied from interface:FormatValidatorA summary message ifFormatValidator.isValid()returnsfalse, otherwise an empty string.- Specified by:
summaryMessagein interfaceFormatValidator- Returns:
- a summary message.
-
-