org.sblim.wbem.cim

Class CIMDataType

Implemented Interfaces:
Cloneable, Serializable

public class CIMDataType
extends java.lang.Object
implements Serializable, Cloneable

Provides the basic interface to define CIM data type defined by the CIM specification.

Field Summary

static int
BOOLEAN
Boolean.
static int
BOOLEAN_ARRAY
static int
CHAR16
16 bit UCS-2 character.
static int
CHAR16_ARRAY
static int
CLASS
Class type.
static int
DATETIME
A string which defines a datetime value according the CIM specification.
static int
DATETIME_ARRAY
static int
INVALID
Invalid type.
static CIMDataType
INVALID_DATATYPE
static int
MAX_ARRAY_TYPE
static int
MAX_SINGLE_TYPE
static int
MIN_ARRAY_TYPE
static int
MIN_SINGLE_TYPE
static int
NULL
Null type.
static CIMDataType
NULL_DATATYPE
static int
NUMERIC
Numeric type for key properties
static int
OBJECT
CIMInstance type.
static int
REAL32
IEEE 4-byte floating point.
static int
REAL32_ARRAY
static int
REAL64
IEEE 8-byte floating point.
static int
REAL64_ARRAY
static int
REFERENCE
Reference type.
static int
REFERENCE_ARRAY
static int
SINT16
Signed 16-bit integer.
static int
SINT16_ARRAY
static int
SINT32
Signed 32-bit integer.
static int
SINT32_ARRAY
static int
SINT64
Signed 64-bit integer.
static int
SINT64_ARRAY
static int
SINT8
Signed 8-bit integer.
static int
SINT8_ARRAY
static int
SIZE_SINGLE
static int
SIZE_UNLIMITED
static int
STRING
UCS String.
static int
STRING_ARRAY
static int
UINT16
Unsigned 16-bit integer.
static int
UINT16_ARRAY
static int
UINT32
Unsigned 32-bit integer.
static int
UINT32_ARRAY
static int
UINT64
Unsigned 64-bit integer.
static int
UINT64_ARRAY
static int
UINT8
Unsigned 8-bit integer.
static int
UINT8_ARRAY

Constructor Summary

CIMDataType(String pRefClassName)
Construct a CIMDataType which is a references of the specified CIMClass.
CIMDataType(String pRefClassName, int pSize)
Construct a CIMDataType which is an array of references of the specified CIMClass.
CIMDataType(int pType)
Constructs an object of cim data type using the specified data type value.
CIMDataType(int pType, int pSize)
Constructs a cim data type with the specified type and size.

Method Summary

Object
clone()
boolean
equals(Object obj)
static int
findArrayType(int pSimpleType)
Returns a value which represents the array type representation of a single type passed as an argument.
static int
findSimpleType(int pArrayType)
Returns a value which represents the single type representation of an array type passed as an argument.
static int
findType(Object pValue)
Returns an integer value that represents the data type for the specified object.
static CIMDataType
getDataType(String typeStr, boolean isArray)
Returns the corresponding CIMDataType object for the specified string type.
static CIMDataType
getPredefinedType(int pType)
Return a predefined value for the CIMDataType.
String
getRefClassName()
Returns the class name pointed by this data type.
int
getSize()
Returns the current size of the data type.
String
getStringType()
Returns the string representation of this type.
int
getType()
Returns the type of this object.
int
hashCode()
boolean
isArrayType()
Defermines if the current data type is an array type.
boolean
isReferenceType()
Determines if the current data type is a reference type.
static boolean
isTypeCompatible(Object pValue, CIMDataType pDataType)
Defermines if the specified data type is is compatible with the data type of the specified value.
static void
main(String[] args)
void
setType(int pType)
Sets the current type of the object.
String
toMOF()
Returns the MOF representation of this object.
String
toString()

Field Details

BOOLEAN

public static final int BOOLEAN
Boolean.
Field Value:
9

BOOLEAN_ARRAY

public static final int BOOLEAN_ARRAY
Field Value:
25

CHAR16

public static final int CHAR16
16 bit UCS-2 character.
Field Value:
13

CHAR16_ARRAY

public static final int CHAR16_ARRAY
Field Value:
29

CLASS

public static final int CLASS
Class type.
Field Value:
33

DATETIME

public static final int DATETIME
A string which defines a datetime value according the CIM specification.
Field Value:
12

DATETIME_ARRAY

public static final int DATETIME_ARRAY
Field Value:
28

INVALID

public static final int INVALID
Invalid type.
Field Value:
-1

INVALID_DATATYPE

public static final CIMDataType INVALID_DATATYPE

MAX_ARRAY_TYPE

public static final int MAX_ARRAY_TYPE
Field Value:
30

MAX_SINGLE_TYPE

public static final int MAX_SINGLE_TYPE
Field Value:
15

MIN_ARRAY_TYPE

public static final int MIN_ARRAY_TYPE
Field Value:
16

MIN_SINGLE_TYPE

public static final int MIN_SINGLE_TYPE
Field Value:
0

NULL

public static final int NULL
Null type.
Field Value:
32

NULL_DATATYPE

public static final CIMDataType NULL_DATATYPE

NUMERIC

public static final int NUMERIC
Numeric type for key properties
Field Value:
15

OBJECT

public static final int OBJECT
CIMInstance type.
Field Value:
31

REAL32

public static final int REAL32
IEEE 4-byte floating point.
Field Value:
10

REAL32_ARRAY

public static final int REAL32_ARRAY
Field Value:
26

REAL64

public static final int REAL64
IEEE 8-byte floating point.
Field Value:
11

REAL64_ARRAY

public static final int REAL64_ARRAY
Field Value:
27

REFERENCE

public static final int REFERENCE
Reference type.
Field Value:
14

REFERENCE_ARRAY

public static final int REFERENCE_ARRAY
Field Value:
30

SINT16

public static final int SINT16
Signed 16-bit integer.
Field Value:
3

SINT16_ARRAY

public static final int SINT16_ARRAY
Field Value:
19

SINT32

public static final int SINT32
Signed 32-bit integer.
Field Value:
5

SINT32_ARRAY

public static final int SINT32_ARRAY
Field Value:
21

SINT64

public static final int SINT64
Signed 64-bit integer.
Field Value:
7

SINT64_ARRAY

public static final int SINT64_ARRAY
Field Value:
23

SINT8

public static final int SINT8
Signed 8-bit integer.
Field Value:
1

SINT8_ARRAY

public static final int SINT8_ARRAY
Field Value:
17

SIZE_SINGLE

public static final int SIZE_SINGLE
Field Value:
-1

SIZE_UNLIMITED

public static final int SIZE_UNLIMITED
Field Value:
-2

STRING

public static final int STRING
UCS String.
Field Value:
8

STRING_ARRAY

public static final int STRING_ARRAY
Field Value:
24

UINT16

public static final int UINT16
Unsigned 16-bit integer.
Field Value:
2

UINT16_ARRAY

public static final int UINT16_ARRAY
Field Value:
18

UINT32

public static final int UINT32
Unsigned 32-bit integer.
Field Value:
4

UINT32_ARRAY

public static final int UINT32_ARRAY
Field Value:
20

UINT64

public static final int UINT64
Unsigned 64-bit integer.
Field Value:
6

UINT64_ARRAY

public static final int UINT64_ARRAY
Field Value:
22

UINT8

public static final int UINT8
Unsigned 8-bit integer.
Field Value:
0

UINT8_ARRAY

public static final int UINT8_ARRAY
Field Value:
16

Constructor Details

CIMDataType

public CIMDataType(String pRefClassName)
Construct a CIMDataType which is a references of the specified CIMClass.
Parameters:
pRefClassName - The referenced class' name

CIMDataType

public CIMDataType(String pRefClassName,
                   int pSize)
Construct a CIMDataType which is an array of references of the specified CIMClass.
Parameters:
pRefClassName - The referenced class' name
pSize - The size of the array

CIMDataType

public CIMDataType(int pType)
Constructs an object of cim data type using the specified data type value. If the specified data type is an array type, assigns the size field to SIZE_UNLIMITED, otherwise assign it to SIZE_SINGLE.
Parameters:
pType - One of the type constants in this class

CIMDataType

public CIMDataType(int pType,
                   int pSize)
Constructs a cim data type with the specified type and size. A valid type value must be passed. This must be a value between MIN_SINGLE_TYPE and MAX_SINGLE_TYPE or between MIN_ARRAY_TYPE and MAX_ARRAY_TYPE. Additionally a valid size must be specified. A positive value or zero indicates that the array length is fixed. A value of SIZE_UNLIMITED means that the array is of variable size A value of SIZE_SINGLE is not meaningful.
Parameters:
pType - One of the type constants in this class
pSize - The desirtd size SIZE_UNLIMITED, 0..MAX_INT_SIZE

Method Details

clone

public Object clone()

equals

public boolean equals(Object obj)

findArrayType

public static int findArrayType(int pSimpleType)
Returns a value which represents the array type representation of a single type passed as an argument.
Parameters:
pSimpleType - The simple type
Returns:
returns the corresponding array element type, or INVALID if the specified data type does not has a corresponding array type element.

findSimpleType

public static int findSimpleType(int pArrayType)
Returns a value which represents the single type representation of an array type passed as an argument.
Parameters:
pArrayType - The array type
Returns:
returns the corresponding single element type, or INVALID if the specified data type does not has a corresponding single type element.

findType

public static int findType(Object pValue)
Returns an integer value that represents the data type for the specified object. (i.e. NULL for null values, UINT8 for Unsigned8 values, and so on). If the value type is undetermined, return INVALID type.
Parameters:
pValue - The value
Returns:
The CIM data type fitting the value

getDataType

public static CIMDataType getDataType(String typeStr,
                                      boolean isArray)
Returns the corresponding CIMDataType object for the specified string type. Given a string representation of the data type (i.e. "uint16") returns the appropriate CIMDataType. The isArray argument determine if the resulting data type must be an array type or a single type element.
Parameters:
typeStr -
isArray -
Returns:
CIMDataType

getPredefinedType

public static CIMDataType getPredefinedType(int pType)
Return a predefined value for the CIMDataType. Applications are encourage to use this method instead of creating new CIMDataType objects. An exception to use this is when an array data type, with an specific size other than unlimited size, needs to be used.
Parameters:
pType - One of the data type constants in this class
Returns:
The data type

getRefClassName

public String getRefClassName()
Returns the class name pointed by this data type.
Returns:
The referenced class' name

getSize

public int getSize()
Returns the current size of the data type.
Returns:
an integer which represents the size of the data type. A value of zero or a positive value means that the data type is an array type, and the value represent the size of the array. If the returned value is SIZE_UNLIMITED, the data type represents an unlimited size array, which means that the size has not been specified. If the returned value is SIZE_SINGLE, the data type represents a single element entity.

getStringType

public String getStringType()
Returns the string representation of this type.
Returns:
The string representation

getType

public int getType()
Returns the type of this object.
Returns:
The type

hashCode

public int hashCode()

isArrayType

public boolean isArrayType()
Defermines if the current data type is an array type.
Returns:
true if this type is an array type, false otherwise

isReferenceType

public boolean isReferenceType()
Determines if the current data type is a reference type.
Returns:
true if this data type is a reference type, false otherwise

isTypeCompatible

public static boolean isTypeCompatible(Object pValue,
                                       CIMDataType pDataType)
Defermines if the specified data type is is compatible with the data type of the specified value.
Parameters:
pValue - The value
pDataType - The data type
Returns:
true, if compatible, falseotherwise

main

public static void main(String[] args)

setType

public void setType(int pType)
Sets the current type of the object. Additionally, modifies the size field to SIZE_UNLIMITED if specified data type is an array type, otherwise assigns it to SIZE_SINGLE
Parameters:
pType - The type

toMOF

public String toMOF()
Returns the MOF representation of this object.
Returns:
Teh MOF representation

toString

public String toString()

Copyright © 2005, 2009 IBM Corporation. All Rights Reserved.