org.apache.commons.configuration.plist
Class PropertyListConfiguration.DateFieldParser

java.lang.Object
  extended by org.apache.commons.configuration.plist.PropertyListConfiguration.DateComponentParser
      extended by org.apache.commons.configuration.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
private  int calendarField
          Stores the calendar field to be processed.
private  int length
          Stores the length of this field.
private  int offset
          An optional offset to add to the calendar field.
 
Constructor Summary
PropertyListConfiguration.DateFieldParser(int calFld, int len)
          Creates a new instance of DateFieldParser.
PropertyListConfiguration.DateFieldParser(int calFld, int len, int ofs)
          Creates a new instance of DateFieldParser and fully initializes it.
 
Method Summary
 void formatComponent(java.lang.StringBuffer buf, java.util.Calendar cal)
          Formats a date component.
 int parseComponent(java.lang.String s, int index, java.util.Calendar cal)
          Parses a component from the given input string.
 
Methods inherited from class org.apache.commons.configuration.plist.PropertyListConfiguration.DateComponentParser
checkLength, padNum
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

calendarField

private int calendarField
Stores the calendar field to be processed.


length

private int length
Stores the length of this field.


offset

private int offset
An optional offset to add to the calendar field.

Constructor Detail

PropertyListConfiguration.DateFieldParser

public PropertyListConfiguration.DateFieldParser(int calFld,
                                                 int len)
Creates a new instance of DateFieldParser.

Parameters:
calFld - the calendar field code
len - the length of this field

PropertyListConfiguration.DateFieldParser

public PropertyListConfiguration.DateFieldParser(int calFld,
                                                 int len,
                                                 int ofs)
Creates a new instance of DateFieldParser and fully initializes it.

Parameters:
calFld - the calendar field code
len - the length of this field
ofs - an offset to add to the calendar field
Method Detail

formatComponent

public void formatComponent(java.lang.StringBuffer buf,
                            java.util.Calendar cal)
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 class PropertyListConfiguration.DateComponentParser
Parameters:
buf - the target buffer
cal - the calendar with the current date

parseComponent

public int parseComponent(java.lang.String s,
                          int index,
                          java.util.Calendar cal)
                   throws ParseException
Description copied from class: PropertyListConfiguration.DateComponentParser
Parses a component from the given input string.

Specified by:
parseComponent in class PropertyListConfiguration.DateComponentParser
Parameters:
s - the string to be parsed
index - the current parsing position
cal - the calendar where to store the result
Returns:
the length of the processed component
Throws:
ParseException - if the component cannot be extracted