cascading.tuple.type
Class DateType

java.lang.Object
  extended by cascading.tuple.type.DateType
All Implemented Interfaces:
CoercibleType<Long>, Serializable, Type

public class DateType
extends Object
implements CoercibleType<Long>

Class DateCoercibleType is an implementation of CoercibleType.

Given a dateFormatString, using the SimpleDateFormat format, this CoercibleType will convert a value from the formatted string to a Long canonical type and back.

This class when presented with a Long timestamp value will assume the value is in UTC.

See DateParser and DateFormatter for similar Operations for use within a pipe assembly.

See Also:
Serialized Form

Field Summary
protected  String dateFormatString
          Field dateFormatString
protected  Locale locale
          Field locale
protected  TimeZone zone
          Field zone
 
Constructor Summary
DateType(String dateFormatString)
          Create a new DateType instance.
DateType(String dateFormatString, TimeZone zone)
           
DateType(String dateFormatString, TimeZone zone, Locale locale)
          Create a new DateType instance.
 
Method Summary
 Long canonical(Object value)
           
 Object coerce(Object value, Type to)
           
protected  Calendar getCalendar()
           
 Class getCanonicalType()
           
 SimpleDateFormat getDateFormat()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

zone

protected TimeZone zone
Field zone


locale

protected Locale locale
Field locale


dateFormatString

protected String dateFormatString
Field dateFormatString

Constructor Detail

DateType

public DateType(String dateFormatString,
                TimeZone zone,
                Locale locale)
Create a new DateType instance.

Parameters:
dateFormatString -
zone -
locale -

DateType

public DateType(String dateFormatString,
                TimeZone zone)

DateType

public DateType(String dateFormatString)
Create a new DateType instance.

Parameters:
dateFormatString -
Method Detail

getCanonicalType

public Class getCanonicalType()
Specified by:
getCanonicalType in interface CoercibleType<Long>
Returns:
the actual Java type this CoercibleType represents

getDateFormat

public SimpleDateFormat getDateFormat()

getCalendar

protected Calendar getCalendar()

canonical

public Long canonical(Object value)
Specified by:
canonical in interface CoercibleType<Long>
Parameters:
value - of type Object
Returns:
the value coerced into its canonical type

coerce

public Object coerce(Object value,
                     Type to)
Specified by:
coerce in interface CoercibleType<Long>
Parameters:
value - of type Object
to - of type Type
Returns:
the value coerced into the requested type

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2007-2015 Concurrent, Inc. All Rights Reserved.