com.davisor.data.stream
Class EnumDataBufferType
java.lang.Object
java.text.Format
com.davisor.data.Type
com.davisor.data.LocaleType
com.davisor.data.FormatType
com.davisor.data.SimpleNumberType
com.davisor.data.FloatType
com.davisor.data.EnumType
com.davisor.data.stream.EnumDataBufferType
- All Implemented Interfaces:
- java.lang.Cloneable, java.util.Comparator, com.davisor.core.Dupable, NumberType, java.io.Serializable
- public class EnumDataBufferType
- extends EnumType
EnumIndexType defines a data type that provides mapping from
integer indexes to DataBuffer values. The underlying data
buffer, if any, is considered strictly a read-only resource. To
enforce this policy, data buffer type is first copied at
construction time. Each time a data element is then read from the
buffer, the element is copied through this type, and the copy is
returned. This makes it possible to edit the returned data element
without any side effects. Likewise, it is now possible to modify
the data buffer type, and make it modify the copied data element
values.
- Since:
- JDK1.1
- See Also:
setFormat(java.lang.String),
EnumData,
DataBuffer,
Serialized Form
| Nested classes inherited from class java.text.Format |
java.text.Format.Field |
|
Constructor Summary |
|
EnumDataBufferType(EnumDataBufferType edbt)
Deep copy constructor. |
|
EnumDataBufferType(java.lang.String dataName,
java.lang.String id,
DataBuffer dataBuffer)
Creates a new enumerated data type. |
protected |
EnumDataBufferType(java.lang.String typeName,
java.lang.String dataName,
java.lang.String id,
java.util.Map metaData,
java.util.Locale locale,
java.lang.String pattern,
java.lang.Object sample,
DataBuffer dataBuffer)
Creates a new enumerated type. |
|
Method Summary |
com.davisor.core.Dupable |
dup()
Makes a deep copy of this object. |
DataValue |
enumValue(int value)
Converts the index to enumerated value. |
java.lang.String |
getFormat()
Gets the type format string. |
void |
setFormat(java.lang.String format)
Sets the type format string. |
| Methods inherited from class com.davisor.data.EnumType |
enumValue, getCompatibility, getSQLCode, getValueClass, stringValue, stringValue, stringValue, stringValue, stringValue, stringValue, stringValue |
| Methods inherited from class com.davisor.data.SimpleNumberType |
byteValue, byteValue, createFormatter, doubleValue, doubleValue, floatValue, floatValue, intValue, intValue, longValue, longValue, numberValue, shortValue, shortValue, zero |
| Methods inherited from class com.davisor.data.Type |
ceil, check, check, compare, create, create, create, create, create, dup, floor, format, getDataName, getId, getID, getMetaData, getMetaData, getSpecs, getSQLName, getSQLName, getTypeName, isNull, parseObject, register, register, setDataName, setId, setID, setMetaData, setMetaData, setSpecs, toString, toXML, xmlEnd, xmlStart |
| Methods inherited from class java.text.Format |
clone, format, formatToCharacterIterator, parseObject |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
TYPENAME
public static final java.lang.String TYPENAME
- Type name ("ENUMDATABUFFER").
- See Also:
- Constant Field Values
M_dataBuffer
protected DataBuffer M_dataBuffer
- Enumerated data values (may be null).
M_dataType
protected Type M_dataType
- Data value type (may be null).
EnumDataBufferType
public EnumDataBufferType(EnumDataBufferType edbt)
- Deep copy constructor. The underlying read-only data buffer is
however copied only by reference.
EnumDataBufferType
public EnumDataBufferType(java.lang.String dataName,
java.lang.String id,
DataBuffer dataBuffer)
throws InvalidDataException
- Creates a new enumerated data type. A local copy of the data
buffer type is also created. The read-only data buffer is not
copied.
- Parameters:
dataName - data name (may be null)id - type identity (may be null)dataBuffer - read-only enumerated data elements (may be null)
- Throws:
InvalidDataException - if data buffer type retrieval fails
EnumDataBufferType
protected EnumDataBufferType(java.lang.String typeName,
java.lang.String dataName,
java.lang.String id,
java.util.Map metaData,
java.util.Locale locale,
java.lang.String pattern,
java.lang.Object sample,
DataBuffer dataBuffer)
throws InvalidDataException
- Creates a new enumerated type. A local copy of the data buffer type
is also created. The read-only data buffer is not copied.
- Parameters:
typeName - type namedataName - data name (may be null)id - type identity (may be null)metaData - type meta data map (may be null)locale - type locale (may be null)pattern - format pattern (may be null)sample - format sample (may be null)dataBuffer - read-only enumerated data elements (may be null)
- Throws:
InvalidDataException - if data buffer type retrieval fails
dup
public com.davisor.core.Dupable dup()
- Makes a deep copy of this object.
- Specified by:
dup in interface com.davisor.core.Dupable- Overrides:
dup in class FloatType
enumValue
public DataValue enumValue(int value)
throws com.davisor.core.NotFoundException
- Converts the index to enumerated value. The data buffer value, if
found, is copied through the local copy of data buffer type.
- Specified by:
enumValue in class EnumType
- Parameters:
value - index of an enumerated value
- Returns:
- copy of enumerated data value
- Throws:
com.davisor.core.NotFoundException - the element with 'value' was not found.
getFormat
public java.lang.String getFormat()
- Gets the type format string. The format is taken from a local
copy of the underlying data buffer type.
- Overrides:
getFormat in class FormatType
- Returns:
- local type spesification string (may be
null) - See Also:
setFormat(java.lang.String)
setFormat
public void setFormat(java.lang.String format)
- Sets the type format string. The new format affect a local
copy of the underlying data buffer type only.
- Overrides:
setFormat in class FormatType
- Parameters:
format - type specification string (may be null)- See Also:
getFormat(),
DataValue.getFormat()
Copyright © 2001-2004 Davisor Oy. All Rights Reserved.