net.sf.farrago.type.runtime
Class EncodedSqlInterval
java.lang.Object
net.sf.farrago.type.runtime.EncodedSqlInterval
- All Implemented Interfaces:
- AssignableValue, DataValue
- Direct Known Subclasses:
- EncodedSqlInterval.EncodedSqlIntervalDT, EncodedSqlInterval.EncodedSqlIntervalYM
public abstract class EncodedSqlInterval
- extends Object
- implements AssignableValue
Runtime type for interval values.
TODO:
- Need to include precision.
- Need to support casting from string, exact numerics
- Both of above would be easier if we just get the SqlIntervalQualifier
- Since:
- Aug 20, 2006
- Version:
- $Id: //open/dev/farrago/src/net/sf/farrago/type/runtime/EncodedSqlInterval.java#11 $
- Author:
- angel
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GET_START_UNIT_METHOD_NAME
public static final String GET_START_UNIT_METHOD_NAME
- See Also:
- Constant Field Values
GET_END_UNIT_METHOD_NAME
public static final String GET_END_UNIT_METHOD_NAME
- See Also:
- Constant Field Values
NF2
protected static final NumberFormat NF2
NF3
protected static final NumberFormat NF3
isNull
private boolean isNull
value
public long value
EncodedSqlInterval
public EncodedSqlInterval()
- Creates a runtime object
parse
protected abstract void parse(String date)
getPrimitiveClass
public static Class getPrimitiveClass()
- Returns:
- long.class
isNull
public boolean isNull()
setNull
public void setNull(boolean b)
assignFrom
public void assignFrom(Object obj)
- Description copied from interface:
AssignableValue
- Assigns value from an Object.
- Specified by:
assignFrom
in interface AssignableValue
- Parameters:
obj
- value to assign, or null to set null
assignFrom
public void assignFrom(long v)
getNullableData
public Object getNullableData()
- Specified by:
getNullableData
in interface DataValue
- Returns:
- an Object representation of this value's data, or null if this
value is null
getStartUnit
protected abstract SqlIntervalQualifier.TimeUnit getStartUnit()
getEndUnit
protected abstract SqlIntervalQualifier.TimeUnit getEndUnit()
floor
public void floor(int timeUnitOrdinal)
- Rounds this interval value down to a unit of time expressed using its
ordinal. Called by generated code.
- Parameters:
timeUnitOrdinal
- Ordinal of SqlIntervalQualifier.TimeUnit
value
floor
protected void floor(SqlIntervalQualifier.TimeUnit timeUnit)
ceil
public void ceil(int timeUnitOrdinal)
- Rounds this interval value up to a unit of time expressed using its
ordinal. Called by generated code.
- Parameters:
timeUnitOrdinal
- Ordinal of SqlIntervalQualifier.TimeUnit
value
ceil
protected void ceil(SqlIntervalQualifier.TimeUnit timeUnit)
appendHours
private static void appendHours(StringBuffer buf,
long hours)
appendMinutes
private static void appendMinutes(StringBuffer buf,
long minutes)
appendSeconds
private static void appendSeconds(StringBuffer buf,
long seconds,
long fractions)