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 classExtractDateTimeField.DateTimeFieldThe field to extract.
-
Field Summary
Fields Modifier and Type Field Description static StringFRIDAYthe friday constant.protected BusinessDaysm_BusinessDayshow to interpret business days.protected Calendarm_Calendarthe calendar for extracting the fields.protected DateTimeTypem_DateTimeTypethe datetime type to process.protected ExtractDateTimeField.DateTimeFieldm_Fieldthe field to extract.protected DateFormatStringm_FormatCustomthe format string to use in case ofExtractDateTimeField.DateTimeField.CUSTOM.protected DateFormatm_FormatterCustomthe formatter for the custom format.protected DateFormatm_FormatterDayOfWeekthe formatter for the localized day of week.static StringMONDAYthe monday constant.static StringSATURDAYthe saturday constant.static StringSUNDAYthe sunday constant.static StringTHURSDAYthe thursday constant.static StringTUESDAYthe tuesday constant.static StringWEDNESDAYthe 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 Classaccepts()Returns the class that is accepted as input.StringbusinessDaysTipText()Returns the tip text for this property.StringdateTimeTypeTipText()Returns the tip text for this property.voiddefineOptions()Adds options to the internal list of options.protected ObjectdoConvert()Performs the actual conversion.StringfieldTipText()Returns the tip text for this property.StringformatCustomTipText()Returns the tip text for this property.Classgenerates()Returns the class that is generated as output.BusinessDaysgetBusinessDays()Returns what business days to use.DateTimeTypegetDateTimeType()Returns the date/time type to convert.ExtractDateTimeField.DateTimeFieldgetField()Returns the field to extractDateFormatStringgetFormatCustom()Returns the custom format in use for the conversion.StringglobalInfo()Returns a string describing the object.protected voidinitialize()Initializes the members.protected voidreset()Resets the converter.voidsetBusinessDays(BusinessDays value)Sets what business days to use.voidsetDateTimeType(DateTimeType value)Sets the date/time type to convert.voidsetField(ExtractDateTimeField.DateTimeField value)Sets the field to extract.voidsetFormatCustom(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:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractOptionHandler
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initializein classAbstractOptionHandler
-
reset
protected void reset()
Resets the converter.- Overrides:
resetin 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:
acceptsin interfaceConversion- Specified by:
acceptsin classAbstractConversion- Returns:
- the class
-
generates
public Class generates()
Returns the class that is generated as output.- Specified by:
generatesin interfaceConversion- Specified by:
generatesin classAbstractConversion- Returns:
- the class
-
doConvert
protected Object doConvert() throws Exception
Performs the actual conversion.- Specified by:
doConvertin classAbstractConversion- Returns:
- the converted data
- Throws:
Exception- if something goes wrong with the conversion
-
-