org.mobicents.protocols.smpp.util
Class SMPPDateFormat

java.lang.Object
  extended by java.text.Format
      extended by org.mobicents.protocols.smpp.util.SMPPDateFormat
All Implemented Interfaces:
Serializable, Cloneable

public class SMPPDateFormat
extends Format

Parse a String to an SMPPDate object.

Version:
$Id: SMPPDateFormat.java 463 2009-06-16 12:07:19Z orank $
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.text.Format
Format.Field
 
Field Summary
static int DEFAULT_YEAR_MODIFIER
          The default year modifier.
 
Constructor Summary
SMPPDateFormat()
           
 
Method Summary
 StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos)
           
 int getYearModifier()
          Get the value for the year modifier.
 Object parseObject(String source, ParsePosition pos)
          Parse a string into an SMPPDate.
 void setYearModifier(int yearModifier)
          Set the value for the year modifier.
 
Methods inherited from class java.text.Format
clone, format, formatToCharacterIterator, parseObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_YEAR_MODIFIER

public static final int DEFAULT_YEAR_MODIFIER
The default year modifier. The year modifier is the value used to convert 2-digit years into their full version. Year modifier is simply added to (or subtracted from) one form to get the other.
int twoDigitYear = fullYear - getYearModifier();
int fullYear = twoDigitYear + getYearModifier();
The default value for this is 2000, meaning the allowed values for a 2-digit year (0 to 99) represent the years 2000 to 2099.

See Also:
Constant Field Values
Constructor Detail

SMPPDateFormat

public SMPPDateFormat()
Method Detail

format

public StringBuffer format(Object obj,
                           StringBuffer toAppendTo,
                           FieldPosition pos)
Specified by:
format in class Format

parseObject

public Object parseObject(String source,
                          ParsePosition pos)
Parse a string into an SMPPDate.

Specified by:
parseObject in class Format
Parameters:
source - The string to parse.
pos - The position to begin parsing from.
Throws:
NullPointerException - if source is null.
IllegalArgumentException - if any of the parsed values exceed their allowed range.

getYearModifier

public int getYearModifier()
Get the value for the year modifier.

Returns:
The current value of the year modifier.
See Also:
DEFAULT_YEAR_MODIFIER

setYearModifier

public void setYearModifier(int yearModifier)
Set the value for the year modifier.

Parameters:
yearModifier - The new value for year modifier.
See Also:
DEFAULT_YEAR_MODIFIER, getYearModifier()


Copyright © 2011 Mobicents. All Rights Reserved.