Package adams.data.conversion
Class ExtractDateTimeField
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.conversion.AbstractConversion
-
- adams.data.conversion.ExtractDateTimeField
-
- All Implemented Interfaces:
AdditionalInformationHandler
,CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,ShallowCopySupporter<AbstractConversion>
,SizeOfHandler
,Stoppable
,Conversion
,Serializable
public class ExtractDateTimeField extends AbstractConversion
Extracts the specified field from a date/time type.
A custom format string can be used with field CUSTOM.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING min-user-mode: Expert
-datetime-type <MSECS|MSECS_LONG|SECONDS|SECONDS_LONG|DATE|DATETIME|DATETIMEMSEC|TIME|TIMEMSEC|BASEDATE|BASEDATETIME|BASEDATETIMEMSEC|BASETIME|BASETIMEMSEC|SERIAL_DATETIME|SERIAL_DATETIME_LONG> (property: dateTimeType) The date/time type to extract the field from. default: DATE
-field <YEAR|MONTH|DAY|HOUR|MINUTE|SECOND|MSEC|DAY_OF_YEAR|DAY_OF_MONTH|DAY_OF_WEEK|DAY_OF_WEEK_STR_EN|DAY_OF_WEEK_STR_LOCALE|WEEK_OF_YEAR|WEEK_OF_MONTH|BUSINESS_DAY_INDICATOR|CUSTOM> (property: field) The field to extract. default: YEAR
-business-days <MONDAY_TO_FRIDAY|MONDAY_TO_SATURDAY|SATURDAY_TO_THURSDAY|SUNDAY_TO_THURSDAY|SUNDAY_TO_FRIDAY> (property: businessDays) How to interpret business days. default: MONDAY_TO_FRIDAY
-format-custom <adams.data.DateFormatString> (property: formatCustom) The format for turning the date/time type into a string in case of field CUSTOM default: yyyy-MM-dd more: https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ExtractDateTimeField.DateTimeField
The field to extract.
-
Field Summary
Fields Modifier and Type Field Description static String
FRIDAY
the friday constant.protected BusinessDays
m_BusinessDays
how to interpret business days.protected Calendar
m_Calendar
the calendar for extracting the fields.protected DateTimeType
m_DateTimeType
the datetime type to process.protected ExtractDateTimeField.DateTimeField
m_Field
the field to extract.protected DateFormatString
m_FormatCustom
the format string to use in case ofExtractDateTimeField.DateTimeField.CUSTOM
.protected DateFormat
m_FormatterCustom
the formatter for the custom format.protected DateFormat
m_FormatterDayOfWeek
the formatter for the localized day of week.static String
MONDAY
the monday constant.static String
SATURDAY
the saturday constant.static String
SUNDAY
the sunday constant.static String
THURSDAY
the thursday constant.static String
TUESDAY
the tuesday constant.static String
WEDNESDAY
the wednesday constant.-
Fields inherited from class adams.data.conversion.AbstractConversion
m_Input, m_Output, m_Owner, m_Stopped
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description ExtractDateTimeField()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class
accepts()
Returns the class that is accepted as input.String
businessDaysTipText()
Returns the tip text for this property.String
dateTimeTypeTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.protected Object
doConvert()
Performs the actual conversion.String
fieldTipText()
Returns the tip text for this property.String
formatCustomTipText()
Returns the tip text for this property.Class
generates()
Returns the class that is generated as output.BusinessDays
getBusinessDays()
Returns what business days to use.DateTimeType
getDateTimeType()
Returns the date/time type to convert.ExtractDateTimeField.DateTimeField
getField()
Returns the field to extractDateFormatString
getFormatCustom()
Returns the custom format in use for the conversion.String
globalInfo()
Returns a string describing the object.protected void
initialize()
Initializes the members.protected void
reset()
Resets the converter.void
setBusinessDays(BusinessDays value)
Sets what business days to use.void
setDateTimeType(DateTimeType value)
Sets the date/time type to convert.void
setField(ExtractDateTimeField.DateTimeField value)
Sets the field to extract.void
setFormatCustom(DateFormatString value)
Sets the custom format to use for the conversion.-
Methods inherited from class adams.data.conversion.AbstractConversion
checkData, cleanUp, convert, getAdditionalInformation, getInput, getInput, getOutput, getOutput, getOwner, getQuickInfo, setInput, setOwner, shallowCopy, shallowCopy, stopExecution
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
SUNDAY
public static final String SUNDAY
the sunday constant.- See Also:
- Constant Field Values
-
MONDAY
public static final String MONDAY
the monday constant.- See Also:
- Constant Field Values
-
TUESDAY
public static final String TUESDAY
the tuesday constant.- See Also:
- Constant Field Values
-
WEDNESDAY
public static final String WEDNESDAY
the wednesday constant.- See Also:
- Constant Field Values
-
THURSDAY
public static final String THURSDAY
the thursday constant.- See Also:
- Constant Field Values
-
FRIDAY
public static final String FRIDAY
the friday constant.- See Also:
- Constant Field Values
-
SATURDAY
public static final String SATURDAY
the saturday constant.- See Also:
- Constant Field Values
-
m_DateTimeType
protected DateTimeType m_DateTimeType
the datetime type to process.
-
m_Field
protected ExtractDateTimeField.DateTimeField m_Field
the field to extract.
-
m_BusinessDays
protected BusinessDays m_BusinessDays
how to interpret business days.
-
m_FormatCustom
protected DateFormatString m_FormatCustom
the format string to use in case ofExtractDateTimeField.DateTimeField.CUSTOM
.
-
m_FormatterCustom
protected transient DateFormat m_FormatterCustom
the formatter for the custom format.
-
m_FormatterDayOfWeek
protected transient DateFormat m_FormatterDayOfWeek
the formatter for the localized day of week.
-
m_Calendar
protected Calendar m_Calendar
the calendar for extracting the fields.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractOptionHandler
-
reset
protected void reset()
Resets the converter.- Overrides:
reset
in classAbstractConversion
-
setDateTimeType
public void setDateTimeType(DateTimeType value)
Sets the date/time type to convert.- Parameters:
value
- the type
-
getDateTimeType
public DateTimeType getDateTimeType()
Returns the date/time type to convert.- Returns:
- the type
-
dateTimeTypeTipText
public String dateTimeTypeTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setField
public void setField(ExtractDateTimeField.DateTimeField value)
Sets the field to extract.- Parameters:
value
- the field
-
getField
public ExtractDateTimeField.DateTimeField getField()
Returns the field to extract- Returns:
- the field
-
fieldTipText
public String fieldTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setBusinessDays
public void setBusinessDays(BusinessDays value)
Sets what business days to use.- Parameters:
value
- the type
-
getBusinessDays
public BusinessDays getBusinessDays()
Returns what business days to use.- Returns:
- the type
-
businessDaysTipText
public String businessDaysTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setFormatCustom
public void setFormatCustom(DateFormatString value)
Sets the custom format to use for the conversion.- Parameters:
value
- the format
-
getFormatCustom
public DateFormatString getFormatCustom()
Returns the custom format in use for the conversion.- Returns:
- the format
-
formatCustomTipText
public String formatCustomTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
accepts
public Class accepts()
Returns the class that is accepted as input.- Specified by:
accepts
in interfaceConversion
- Specified by:
accepts
in classAbstractConversion
- Returns:
- the class
-
generates
public Class generates()
Returns the class that is generated as output.- Specified by:
generates
in interfaceConversion
- Specified by:
generates
in classAbstractConversion
- Returns:
- the class
-
doConvert
protected Object doConvert() throws Exception
Performs the actual conversion.- Specified by:
doConvert
in classAbstractConversion
- Returns:
- the converted data
- Throws:
Exception
- if something goes wrong with the conversion
-
-