|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.metamatrix.connector.text.StringToDateTranslator
public class StringToDateTranslator
This is a helper class for TextTranslators that can be used to translate any String that is a representation of a date to a java.util.Date object. This class is created by passing it a properties object that contains at least one property. The value of this property is a String that can be a delimited list of date format Strings. Date format Strings can be any format String that a java.text.SimpleDateFormat can be created with. There is also an optional property that defines the delimiter for the list of Date format Strings. If this property is not specified then the entire String value of the DateFormatStrings property will be used as the only format that this class can translate.
After this class is created it can the be used to translate Strings into java.util.Date object using the translateStringToDate(String) method.
Constructor Summary | |
---|---|
StringToDateTranslator(java.util.Properties props,
ConnectorLogger logger)
This class is created by passing it a properties object that contains at least one property. |
Method Summary | |
---|---|
boolean |
hasFormatters()
This method is used to check the status of this translator object. |
java.util.Date |
translateStringToDate(java.lang.String string)
This method is used to translate String representations of dates into java.util.Date objects using a set of formats passed into this class at creation time. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StringToDateTranslator(java.util.Properties props, ConnectorLogger logger)
This class is created by passing it a properties object that contains at least one property. The value of this property is a String that can be a delimited list of date format Strings. Date format Strings can be any format String that a java.text.SimpleDateFormat can be created with. There is also an optional property that defines the delimiter for the list of Date format Strings. If this property is not specified then the entire String value of the DateFormatStrings property will be used as the only format that this class can translate.
Note that the order of the list of date format strings is important because the translator attempts to translate the String passed to it in the order of the date format Strings in the delimited property value.
After this class is created it can the be used to translate Strings into java.util.Date object using the translateStringToDate(String) method.
The properties that are required in construction of this class are as follows: PropertyName: TextPropertyNames.DATE_RESULT_FORMATS PropertyValue: Delimited list of date format Strings: ie MM/dd/yy' 'hh:mm:ss PropertyName: TextPropertyNames.DATE_RESULT_FORMATS_DELIMITER PropertyValue: Delimiter for value of TextPropertyNames.DATE_RESULT_FORMATS
Method Detail |
---|
public java.util.Date translateStringToDate(java.lang.String string) throws java.text.ParseException
string
- the String to be parsed into a java.util.Date
java.text.ParseException
- if the String passed in could not be parsedpublic boolean hasFormatters()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |