org.specrunner.converters.core
Class AbstractConverterTimeTemplate<T>

java.lang.Object
  extended by org.specrunner.converters.core.ConverterDefault
      extended by org.specrunner.converters.core.ConverterNotNullNotEmpty
          extended by org.specrunner.converters.core.AbstractConverterTimezone<T>
              extended by org.specrunner.converters.core.AbstractConverterTimeTemplate<T>
Type Parameters:
T - Date object.
All Implemented Interfaces:
Serializable, IConverter, IResetable
Direct Known Subclasses:
ConverterDateCurrentTemplate, ConverterDateTimeCurrentTemplate, ConverterLocalDateCurrentTemplate, ConverterTimestampCurrentTemplate

public abstract class AbstractConverterTimeTemplate<T>
extends AbstractConverterTimezone<T>

Create time information.

Author:
Thiago Santos
See Also:
Serialized Form

Field Summary
protected  List<String> values
          Strings that stand for 'current date'.
 
Fields inherited from class org.specrunner.converters.core.AbstractConverterTimezone
cacheTimezone, FEATURE_TIMEZONE, timezone
 
Constructor Summary
AbstractConverterTimeTemplate(List<String> values)
          Constructor using strings.
 
Method Summary
 Object convert(Object value, Object[] args)
          Convert a given object to another using some arguments as auxiliary.
protected abstract  T instance()
          Creates an instance of date.
protected  T postProcess(Object value, Object[] args, T result)
          Post process a instance of data.
protected  boolean testValue(String str, String value)
          Test the string against a value.
 
Methods inherited from class org.specrunner.converters.core.AbstractConverterTimezone
getTimezone, getZone, initialize, setTimezone
 
Methods inherited from class org.specrunner.converters.core.ConverterNotNullNotEmpty
accept
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

values

protected List<String> values
Strings that stand for 'current date'.

Constructor Detail

AbstractConverterTimeTemplate

public AbstractConverterTimeTemplate(List<String> values)
Constructor using strings.

Parameters:
values - The values to be converted to date.
Method Detail

convert

public Object convert(Object value,
                      Object[] args)
               throws ConverterException
Description copied from interface: IConverter
Convert a given object to another using some arguments as auxiliary.

Specified by:
convert in interface IConverter
Overrides:
convert in class ConverterNotNullNotEmpty
Parameters:
value - The value to be converted.
args - The arguments.
Returns:
The converted object.
Throws:
ConverterException - On conversion errors.

testValue

protected boolean testValue(String str,
                            String value)
Test the string against a value.

Parameters:
str - String.
value - A value.
Returns:
true, if valid, false, otherwise.

instance

protected abstract T instance()
Creates an instance of date.

Returns:
Something aka date.

postProcess

protected T postProcess(Object value,
                        Object[] args,
                        T result)
Post process a instance of data.

Parameters:
value - The original value.
args - The arguments.
result - The result.
Returns:
A time processed. i.e. plusDays, if specified.


Copyright © 2015. All rights reserved.