net.sf.farrago.type.runtime
Class NullablePrimitive

java.lang.Object
  extended by net.sf.farrago.type.runtime.NullablePrimitive
All Implemented Interfaces:
AssignableValue, DataValue, NullableValue
Direct Known Subclasses:
NullablePrimitive.NullableBoolean, NullablePrimitive.NullableByte, NullablePrimitive.NullableDouble, NullablePrimitive.NullableFloat, NullablePrimitive.NullableInteger, NullablePrimitive.NullableLong, NullablePrimitive.NullableShort

public abstract class NullablePrimitive
extends Object
implements NullableValue, AssignableValue

NullablePrimitive is the abstract superclass for implementations of NullableValue corresponding to Java primitives. These holder classes are declared as static inner classes of NullablePrimitive with names taken from the standard holder classes in java.lang.

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/type/runtime/NullablePrimitive.java#32 $
Author:
John V. Sichi

Nested Class Summary
static class NullablePrimitive.NullableBoolean
          Nullable wrapper for boolean.
static class NullablePrimitive.NullableByte
          Nullable wrapper for byte.
static class NullablePrimitive.NullableDouble
          Nullable wrapper for double.
static class NullablePrimitive.NullableFloat
          Nullable wrapper for float.
static class NullablePrimitive.NullableInteger
          Nullable wrapper for int.
static class NullablePrimitive.NullableLong
          Nullable wrapper for long.
static class NullablePrimitive.NullableShort
          Nullable wrapper for short.
 
Field Summary
static String FALSE_LITERAL
           
private static Integer INT_ONE
           
private static Integer INT_ZERO
           
 boolean isNull
          Whether this value is null.
static String NULL_IND_FIELD_NAME
          Name of field storing null indicator.
static String TRUE_LITERAL
           
static String UNKNOWN_LITERAL
           
static String VALUE_FIELD_NAME
          Name of field storing value.
 
Fields inherited from interface net.sf.farrago.type.runtime.NullableValue
NULL_IND_ACCESSOR_NAME, NULL_IND_MUTATOR_NAME
 
Fields inherited from interface net.sf.farrago.type.runtime.AssignableValue
ASSIGNMENT_METHOD_NAME
 
Constructor Summary
NullablePrimitive()
           
 
Method Summary
 void assignFrom(Object obj)
          Assigns value from an Object.
 Object getNullableData()
           
 boolean isNull()
           
protected abstract  void setLong(long n)
          Assignment from non-null long value.
 void setNull(boolean isNull)
          Sets whether or not the value is null.
protected abstract  void setNumber(Number number)
          Assignment from abstract Number object.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VALUE_FIELD_NAME

public static final String VALUE_FIELD_NAME
Name of field storing value.

See Also:
Constant Field Values

TRUE_LITERAL

public static final String TRUE_LITERAL
See Also:
Constant Field Values

FALSE_LITERAL

public static final String FALSE_LITERAL
See Also:
Constant Field Values

UNKNOWN_LITERAL

public static final String UNKNOWN_LITERAL
See Also:
Constant Field Values

NULL_IND_FIELD_NAME

public static final String NULL_IND_FIELD_NAME
Name of field storing null indicator.

See Also:
Constant Field Values

INT_ONE

private static final Integer INT_ONE

INT_ZERO

private static final Integer INT_ZERO

isNull

public boolean isNull
Whether this value is null.

Constructor Detail

NullablePrimitive

public NullablePrimitive()
Method Detail

setNull

public void setNull(boolean isNull)
Description copied from interface: NullableValue
Sets whether or not the value is null. Note that once a value has been set to null, its data should not be updated until the null state has been cleared with a call to setNull(false).

Specified by:
setNull in interface NullableValue
Parameters:
isNull - true to set a null value; false to indicate a non-null value

isNull

public boolean isNull()
Specified by:
isNull in interface NullableValue
Returns:
whether the value has been set to null

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

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

setNumber

protected abstract void setNumber(Number number)
Assignment from abstract Number object.

Parameters:
number - a new non-null value to be assigned

setLong

protected abstract void setLong(long n)
Assignment from non-null long value.

Parameters:
n - long value to assign

toString

public String toString()
Overrides:
toString in class Object