Class PropertyListConfiguration.DateFieldParser
java.lang.Object
org.apache.commons.configuration2.plist.PropertyListConfiguration.DateComponentParser
org.apache.commons.configuration2.plist.PropertyListConfiguration.DateFieldParser
- Enclosing class:
- PropertyListConfiguration
private static class PropertyListConfiguration.DateFieldParser
extends PropertyListConfiguration.DateComponentParser
A specialized date component parser implementation that deals with numeric calendar fields. The class is able to
extract fields from a string literal and to format a literal from a calendar.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int
Stores the calendar field to be processed.private final int
Stores the length of this field.private final int
An optional offset to add to the calendar field. -
Constructor Summary
ConstructorsConstructorDescriptionDateFieldParser
(int calFld, int len) Creates a new instance ofDateFieldParser
.DateFieldParser
(int calFld, int len, int ofs) Creates a new instance ofDateFieldParser
and fully initializes it. -
Method Summary
Modifier and TypeMethodDescriptionvoid
formatComponent
(StringBuilder buf, Calendar cal) Formats a date component.int
parseComponent
(String s, int index, Calendar cal) Parses a component from the given input string.Methods inherited from class org.apache.commons.configuration2.plist.PropertyListConfiguration.DateComponentParser
checkLength, padNum
-
Field Details
-
calendarField
private final int calendarFieldStores the calendar field to be processed. -
length
private final int lengthStores the length of this field. -
offset
private final int offsetAn optional offset to add to the calendar field.
-
-
Constructor Details
-
DateFieldParser
public DateFieldParser(int calFld, int len) Creates a new instance ofDateFieldParser
.- Parameters:
calFld
- the calendar field codelen
- the length of this field
-
DateFieldParser
public DateFieldParser(int calFld, int len, int ofs) Creates a new instance ofDateFieldParser
and fully initializes it.- Parameters:
calFld
- the calendar field codelen
- the length of this fieldofs
- an offset to add to the calendar field
-
-
Method Details
-
formatComponent
Description copied from class:PropertyListConfiguration.DateComponentParser
Formats a date component. This method is used for converting a date in its internal representation into a string literal.- Specified by:
formatComponent
in classPropertyListConfiguration.DateComponentParser
- Parameters:
buf
- the target buffercal
- the calendar with the current date
-
parseComponent
Description copied from class:PropertyListConfiguration.DateComponentParser
Parses a component from the given input string.- Specified by:
parseComponent
in classPropertyListConfiguration.DateComponentParser
- Parameters:
s
- the string to be parsedindex
- the current parsing positioncal
- the calendar where to store the result- Returns:
- the length of the processed component
- Throws:
ParseException
- if the component cannot be extracted
-