nl.knaw.dans.common.dbflib
Class NumberValue

java.lang.Object
  extended by nl.knaw.dans.common.dbflib.Value
      extended by nl.knaw.dans.common.dbflib.NumberValue

public class NumberValue
extends Value

Represents a number value in a record. If the NumberValue was initialized with a raw value (by the library), it will return a typed value that is a subclass of Number and is large enough to accommodate the value. It will try to be economical when doing this. For instance it will choose an Integer over a Long if possible.

Author:
Jan van Mansum

Field Summary
 
Fields inherited from class nl.knaw.dans.common.dbflib.Value
typed
 
Constructor Summary
NumberValue(Number number)
          Creates a new NumberValue object.
 
Method Summary
protected  byte[] doGetRawValue(Field field)
          Converts the typed value to a byte array, according to the field specifications provided.
protected  Object doGetTypedValue(byte[] rawValue)
          Converts the raw bytes to a Java object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NumberValue

public NumberValue(Number number)
Creates a new NumberValue object.

Parameters:
number - a number
Method Detail

doGetTypedValue

protected Object doGetTypedValue(byte[] rawValue)
Description copied from class: Value
Converts the raw bytes to a Java object. The class of Java object to create is determined by the subclass of Value.

Specified by:
doGetTypedValue in class Value
Returns:
the value as a Java object

doGetRawValue

protected byte[] doGetRawValue(Field field)
Description copied from class: Value
Converts the typed value to a byte array, according to the field specifications provided.

Specified by:
doGetRawValue in class Value
Parameters:
field - the field specifications
Returns:
a byte array containing the raw value


Copyright © 2009-2012 DANS. All Rights Reserved.