public class DataObject
extends java.lang.Object
Either stores a Number
, List
of DataObject
s, a byte array, BitString
or a subtype
CosemDateFormat
.
Modifier and Type | Method and Description |
---|---|
org.openmuc.jdlms.internal.asn1.cosem.Data.Choices |
choiceIndex() |
boolean |
isBitString()
Is used to determine if the data contains a
BitString object. |
boolean |
isBoolean()
Checks if the data of this container is a boolean.
|
boolean |
isByteArray()
Checks if the data of this container is a byte array.
|
boolean |
isComplex()
Checks if the data of this container is of a complex type.
|
boolean |
isCosemDateFormat()
Checks if the data of this container is a
CosemDateFormat object. |
boolean |
isNull()
Checks if the data of this container is
null . |
boolean |
isNumber()
Checks if the data of this container is a number
|
static DataObject |
newArrayData(java.util.List<DataObject> array)
Constructs a array data.
|
static DataObject |
newBcdData(byte bcd)
Constructs a 2 digit BCD number data
|
static DataObject |
newBitStringData(BitString bitString)
Constructs a bit string data.
|
static DataObject |
newBoolData(boolean bool)
Constructs a bool data.
|
static DataObject |
newDateData(CosemDate date)
Constructs a calendar datum holding a date
|
static DataObject |
newDateTimeData(CosemDateTime dateTime)
Constructs a calendar datum holding date and time
|
static DataObject |
newEnumerateData(int enumVal)
Constructs a enum data
|
static DataObject |
newFloat32Data(float float32)
Constructs a 32 bit floating point number data.
|
static DataObject |
newFloat64Data(double float64)
Constructs a 64 bit floating point number data.
|
static DataObject |
newInteger16Data(short int16)
Constructs a int 16 data
|
static DataObject |
newInteger32Data(int int32)
Constructs a int 32 data.
|
static DataObject |
newInteger64Data(long int64)
Constructs a int 64 data
|
static DataObject |
newInteger8Data(byte int8)
Constructs a int 8 data
|
static DataObject |
newNullData()
Constructs a empty datum.
|
static DataObject |
newOctetStringData(byte[] string)
Constructs a byte array data.
|
static DataObject |
newStructureData(java.util.List<DataObject> structure)
Constructs a structure data.
|
static DataObject |
newTimeData(CosemTime time)
Constructs a calendar datum holding a time
|
static DataObject |
newUInteger16Data(int uInt16)
Constructs a unsigned int 16 data
|
static DataObject |
newUInteger32Data(long uIn32)
Constructs a unsigned int 32 data.
|
static DataObject |
newUInteger64Data(long uInt64)
Constructs a unsigned int 64 data
|
static DataObject |
newUInteger8Data(short uInt8)
Constructs a unsigned int 8 data
|
static DataObject |
newVisibleStringData(byte[] string)
Constructs a string, encoded as byte array data.
|
java.lang.Object |
rawValue()
Returns the raw object-value.
|
<T> T |
value()
Returns the value.
|
public static DataObject newNullData()
public static DataObject newArrayData(java.util.List<DataObject> array) throws java.lang.IllegalArgumentException
array
- The array of valuesjava.lang.IllegalArgumentException
- If a sub element of array has another data type than the firstpublic static DataObject newStructureData(java.util.List<DataObject> structure)
structure
- The structure of valuespublic static DataObject newBoolData(boolean bool)
bool
- The structure of valuespublic static DataObject newBitStringData(BitString bitString) throws java.lang.IllegalArgumentException
bitString
- The BitString
object holding the bit stringjava.lang.IllegalArgumentException
public static DataObject newInteger32Data(int int32)
int32
- he number to storepublic static DataObject newUInteger32Data(long uIn32)
uIn32
- he number to storejava.lang.IllegalArgumentException
- if uInt32 is > 2^(32)-1 or negativepublic static DataObject newOctetStringData(byte[] string)
string
- The byte array to storepublic static DataObject newVisibleStringData(byte[] string)
string
- The byte string to storepublic static DataObject newBcdData(byte bcd) throws java.lang.IllegalArgumentException
bcd
- The BCD number to storejava.lang.IllegalArgumentException
public static DataObject newInteger8Data(byte int8) throws java.lang.IllegalArgumentException
int8
- The number to storejava.lang.IllegalArgumentException
public static DataObject newUInteger8Data(short uInt8) throws java.lang.IllegalArgumentException
uInt8
- The number to storejava.lang.IllegalArgumentException
- if uInt8 > 2^(8)-1 or negativepublic static DataObject newInteger16Data(short int16)
int16
- The number to storepublic static DataObject newUInteger16Data(int uInt16)
uInt16
- The number to storejava.lang.IllegalArgumentException
- If newVal > 2^(16)-1 or negativepublic static DataObject newInteger64Data(long int64)
int64
- The number to storepublic static DataObject newUInteger64Data(long uInt64)
uInt64
- The number to storejava.lang.IllegalArgumentException
- if uInt64 is negativepublic static DataObject newEnumerateData(int enumVal)
enumVal
- The enum value to storejava.lang.IllegalArgumentException
- if newVal is > 2^(8)-1 or negativepublic static DataObject newFloat32Data(float float32)
float32
- The number to storepublic static DataObject newFloat64Data(double float64)
float64
- The number to storepublic static DataObject newDateTimeData(CosemDateTime dateTime)
dateTime
- The date and time to storepublic static DataObject newDateData(CosemDate date)
date
- The date storepublic static DataObject newTimeData(CosemTime time)
time
- The time storepublic org.openmuc.jdlms.internal.asn1.cosem.Data.Choices choiceIndex()
public <T> T value() throws java.lang.ClassCastException
T
- the type in which the raw data should be cast.java.lang.ClassCastException
- when the value doesn't match the assigned type.public java.lang.Object rawValue()
public boolean isBitString()
BitString
object.BitString
object.public boolean isNumber()
public boolean isComplex()
A complex container holds one or more sub container of type DataObject
as values.
A container is of complex type if choiceIndex()
returns either Data.Choices.ARRAY
,
Data.Choices.STRUCTURE
or Data.Choices.COMPACT_ARRAY
.
DataObject
holds a List
of DataObject
.public boolean isByteArray()
A container is a byte array if choiceIndex()
returns either Data.Choices.OCTET_STRING
,
Data.Choices.VISIBLE_STRING
or Data.Choices.BIT_STRING
.
byte[]
).public boolean isBoolean()
true
if the data is a boolean.public boolean isCosemDateFormat()
CosemDateFormat
object.
A container is a calendar if choiceIndex()
returns either Data.Choices.DATE_TIME
,
Data.Choices.DATE
or Data.Choices.TIME
.
true
if the data is a CosemDateFormat
.public boolean isNull()
null
.true
if the data is null
.