Class StringFormatPart
java.lang.Object
org.jboss.logging.processor.validation.AbstractFormatPart
org.jboss.logging.processor.validation.StringFormatPart
- All Implemented Interfaces:
Comparable<FormatPart>, FormatPart
The parameter part of a format for
}.
Date: 13.06.2011
Formatter.
Represents the following format
invalid @linkplain
{@linkplain %[argument_index$][flags][width][.precision]conversion
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe conversions for the string format.static enumThe flags for the string message format. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringFormatPart.Conversionprivate Characterprivate final Set<StringFormatPart.Flag> private intprivate final intprivate intprivate intFields inherited from interface FormatPart
STRING -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateStringFormatPart(int position) Creates a parameter format part. -
Method Summary
Modifier and TypeMethodDescriptionThe conversion for the string format.charThe date/time conversion character.flags()A collection of the flags.intindex()Returns the format parameter index.private voidInitializes the flags based on the string.private voidInitializes the index field based on the string.private voidInitializes the precision based on the string.private voidInitializes the width based on the string.static StringFormatPartCreates a parameter part of a format string.part()The part of the format.intposition()The position for the part.intThe precision for the format.toString()intwidth()The width for the format.Methods inherited from class AbstractFormatPart
compareTo
-
Field Details
-
index
private int index -
flags
-
width
private int width -
precision
private int precision -
conversion
-
dateTimeConversion
-
position
private final int position
-
-
Constructor Details
-
StringFormatPart
private StringFormatPart(int position) Creates a parameter format part.- Parameters:
position- the position in the string format.
-
-
Method Details
-
of
Creates a parameter part of a format string.- Parameters:
position- the position of the part.group- the group array of the formats (must be a length of 6).- Returns:
- the the parameter part.
- Throws:
IllegalArgumentException- if the length of the group array is not equal to 6 or a format was invalid.
-
index
public int index()Returns the format parameter index. If the index is inherited,-1is returned.- Returns:
- the format parameter index.
-
flags
-
width
public int width()The width for the format. If the width was not specified,-1is returned.- Returns:
- the width.
-
precision
public int precision()The precision for the format. If the precision was not specified,-1is returned.- Returns:
- the precision.
-
conversion
The conversion for the string format.- Returns:
- the conversion.
-
dateTimeChar
public char dateTimeChar()The date/time conversion character.nullif there is not date time conversion character.- Returns:
- the date/time conversion character or
null.
-
initIndex
Initializes the index field based on the string.- Parameters:
s- the index in string form.- Throws:
IllegalArgumentException- if the string is not a number.
-
initFlags
Initializes the flags based on the string. Will set theindexto-1if theStringFormatPart.Flag.PREVIOUSflag is found.- Parameters:
s- the flags in string form.- Throws:
DuplicateFormatFlagsException- if the flag is specified more than once.
-
initWidth
Initializes the width based on the string.- Parameters:
s- the width in string form.- Throws:
IllegalArgumentException- the string is an invalid number.
-
initPrecision
Initializes the precision based on the string.- Parameters:
s- the precision in string form.- Throws:
IllegalArgumentException- if the precision is less than 0 or an invalid number.
-
position
public int position()Description copied from interface:FormatPartThe position for the part.- Returns:
- the position.
-
part
Description copied from interface:FormatPartThe part of the format.- Returns:
- the part of the format.
-
toString
- Overrides:
toStringin classAbstractFormatPart
-