public final class PatternParser extends Object
EnhancedPatternLayout
class
is delegated to the PatternParser class.
It is this class that parses conversion patterns and creates
a chained list of PatternConverters
.
Modifier and Type | Class and Description |
---|---|
private static class |
PatternParser.ReadOnlyMap
The class wraps another Map but throws exceptions on any attempt to modify the map.
|
Modifier and Type | Field and Description |
---|---|
private static int |
CONVERTER_STATE
In converter name state.
|
private static int |
DOT_STATE
Dot state.
|
private static char |
ESCAPE_CHAR
Escape character for format specifier.
|
private static Map |
FILENAME_PATTERN_RULES
Standard format specifiers for rolling file appenders.
|
private static int |
LITERAL_STATE
Literal state.
|
private static int |
MAX_STATE
Max state.
|
private static int |
MIN_STATE
Min state.
|
private static Map |
PATTERN_LAYOUT_RULES
Standard format specifiers for EnhancedPatternLayout.
|
Modifier | Constructor and Description |
---|---|
private |
PatternParser()
Private constructor.
|
Modifier and Type | Method and Description |
---|---|
private static PatternConverter |
createConverter(String converterId,
StringBuffer currentLiteral,
Map converterRegistry,
Map rules,
List options)
Creates a new PatternConverter.
|
private static int |
extractConverter(char lastChar,
String pattern,
int i,
StringBuffer convBuf,
StringBuffer currentLiteral)
Extract the converter identifier found at position i.
|
private static int |
extractOptions(String pattern,
int i,
List options)
Extract options.
|
private static int |
finalizeConverter(char c,
String pattern,
int i,
StringBuffer currentLiteral,
FormattingInfo formattingInfo,
Map converterRegistry,
Map rules,
List patternConverters,
List formattingInfos)
Processes a format specifier sequence.
|
static Map |
getFileNamePatternRules()
Get standard format specifiers for rolling file appender file specification.
|
static Map |
getPatternLayoutRules()
Get standard format specifiers for EnhancedPatternLayout.
|
static void |
parse(String pattern,
List patternConverters,
List formattingInfos,
Map converterRegistry,
Map rules)
Parse a format specifier.
|
private static final char ESCAPE_CHAR
private static final int LITERAL_STATE
private static final int CONVERTER_STATE
private static final int DOT_STATE
private static final int MIN_STATE
private static final int MAX_STATE
private static final Map PATTERN_LAYOUT_RULES
private static final Map FILENAME_PATTERN_RULES
private PatternParser()
public static Map getPatternLayoutRules()
public static Map getFileNamePatternRules()
private static int extractConverter(char lastChar, String pattern, int i, StringBuffer convBuf, StringBuffer currentLiteral)
lastChar
- last processed character.pattern
- format string.i
- current index into pattern format.convBuf
- buffer to receive conversion specifier.currentLiteral
- literal to be output in case format specifier in unrecognized.private static int extractOptions(String pattern, int i, List options)
pattern
- conversion pattern.i
- start of options.options
- array to receive extracted optionspublic static void parse(String pattern, List patternConverters, List formattingInfos, Map converterRegistry, Map rules)
pattern
- pattern to parse.patternConverters
- list to receive pattern converters.formattingInfos
- list to receive field specifiers corresponding to pattern converters.converterRegistry
- map of user-supported pattern converters keyed by format specifier, may be null.rules
- map of stock pattern converters keyed by format specifier.private static PatternConverter createConverter(String converterId, StringBuffer currentLiteral, Map converterRegistry, Map rules, List options)
converterId
- converterId.currentLiteral
- literal to be used if converter is unrecognized or following converter
if converterId contains extra characters.converterRegistry
- map of user-supported pattern converters keyed by format specifier, may be null.rules
- map of stock pattern converters keyed by format specifier.options
- converter options.private static int finalizeConverter(char c, String pattern, int i, StringBuffer currentLiteral, FormattingInfo formattingInfo, Map converterRegistry, Map rules, List patternConverters, List formattingInfos)
c
- initial character of format specifier.pattern
- conversion patterni
- current position in conversion pattern.currentLiteral
- current literal.formattingInfo
- current field specifier.converterRegistry
- map of user-provided pattern converters keyed by format specifier, may be null.rules
- map of stock pattern converters keyed by format specifier.patternConverters
- list to receive parsed pattern converter.formattingInfos
- list to receive corresponding field specifier.WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses