Package org.sblim.wbem.cim
Class CIMDataType
- java.lang.Object
-
- org.sblim.wbem.cim.CIMDataType
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
public class CIMDataType extends java.lang.Object implements java.io.Serializable, java.lang.Cloneable
Provides the basic interface to define CIM data type defined by the CIM specification.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description 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 propertiesstatic 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
Constructors Constructor Description 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.CIMDataType(java.lang.String pRefClassName)
Construct a CIMDataType which is a references of the specified CIMClass.CIMDataType(java.lang.String pRefClassName, int pSize)
Construct a CIMDataType which is an array of references of the specified CIMClass.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
clone()
boolean
equals(java.lang.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(java.lang.Object pValue)
Returns an integer value that represents the data type for the specified object.static CIMDataType
getDataType(java.lang.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.java.lang.String
getRefClassName()
Returns the class name pointed by this data type.int
getSize()
Returns the current size of the data type.java.lang.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(java.lang.Object pValue, CIMDataType pDataType)
Defermines if the specified data type is is compatible with the data type of the specified value.static void
main(java.lang.String[] args)
void
setType(int pType)
Sets the current type of the object.java.lang.String
toMOF()
Returns the MOF representation of this object.java.lang.String
toString()
-
-
-
Field Detail
-
INVALID
public static final int INVALID
Invalid type.- See Also:
- Constant Field Values
-
UINT8
public static final int UINT8
Unsigned 8-bit integer.- See Also:
- Constant Field Values
-
SINT8
public static final int SINT8
Signed 8-bit integer.- See Also:
- Constant Field Values
-
UINT16
public static final int UINT16
Unsigned 16-bit integer.- See Also:
- Constant Field Values
-
SINT16
public static final int SINT16
Signed 16-bit integer.- See Also:
- Constant Field Values
-
UINT32
public static final int UINT32
Unsigned 32-bit integer.- See Also:
- Constant Field Values
-
SINT32
public static final int SINT32
Signed 32-bit integer.- See Also:
- Constant Field Values
-
UINT64
public static final int UINT64
Unsigned 64-bit integer.- See Also:
- Constant Field Values
-
SINT64
public static final int SINT64
Signed 64-bit integer.- See Also:
- Constant Field Values
-
STRING
public static final int STRING
UCS String.- See Also:
- Constant Field Values
-
BOOLEAN
public static final int BOOLEAN
Boolean.- See Also:
- Constant Field Values
-
REAL32
public static final int REAL32
IEEE 4-byte floating point.- See Also:
- Constant Field Values
-
REAL64
public static final int REAL64
IEEE 8-byte floating point.- See Also:
- Constant Field Values
-
DATETIME
public static final int DATETIME
A string which defines a datetime value according the CIM specification.- See Also:
- Constant Field Values
-
CHAR16
public static final int CHAR16
16 bit UCS-2 character.- See Also:
- Constant Field Values
-
REFERENCE
public static final int REFERENCE
Reference type.- See Also:
- Constant Field Values
-
NUMERIC
public static final int NUMERIC
Numeric type for key properties- See Also:
- Constant Field Values
-
UINT8_ARRAY
public static final int UINT8_ARRAY
- See Also:
- Constant Field Values
-
SINT8_ARRAY
public static final int SINT8_ARRAY
- See Also:
- Constant Field Values
-
UINT16_ARRAY
public static final int UINT16_ARRAY
- See Also:
- Constant Field Values
-
SINT16_ARRAY
public static final int SINT16_ARRAY
- See Also:
- Constant Field Values
-
UINT32_ARRAY
public static final int UINT32_ARRAY
- See Also:
- Constant Field Values
-
SINT32_ARRAY
public static final int SINT32_ARRAY
- See Also:
- Constant Field Values
-
UINT64_ARRAY
public static final int UINT64_ARRAY
- See Also:
- Constant Field Values
-
SINT64_ARRAY
public static final int SINT64_ARRAY
- See Also:
- Constant Field Values
-
STRING_ARRAY
public static final int STRING_ARRAY
- See Also:
- Constant Field Values
-
BOOLEAN_ARRAY
public static final int BOOLEAN_ARRAY
- See Also:
- Constant Field Values
-
REAL32_ARRAY
public static final int REAL32_ARRAY
- See Also:
- Constant Field Values
-
REAL64_ARRAY
public static final int REAL64_ARRAY
- See Also:
- Constant Field Values
-
DATETIME_ARRAY
public static final int DATETIME_ARRAY
- See Also:
- Constant Field Values
-
CHAR16_ARRAY
public static final int CHAR16_ARRAY
- See Also:
- Constant Field Values
-
REFERENCE_ARRAY
public static final int REFERENCE_ARRAY
- See Also:
- Constant Field Values
-
OBJECT
public static final int OBJECT
CIMInstance type.- See Also:
- Constant Field Values
-
NULL
public static final int NULL
Null type.- See Also:
- Constant Field Values
-
CLASS
public static final int CLASS
Class type.- See Also:
- Constant Field Values
-
SIZE_SINGLE
public static final int SIZE_SINGLE
- See Also:
- Constant Field Values
-
SIZE_UNLIMITED
public static final int SIZE_UNLIMITED
- See Also:
- Constant Field Values
-
MIN_SINGLE_TYPE
public static final int MIN_SINGLE_TYPE
- See Also:
- Constant Field Values
-
MAX_SINGLE_TYPE
public static final int MAX_SINGLE_TYPE
- See Also:
- Constant Field Values
-
MIN_ARRAY_TYPE
public static final int MIN_ARRAY_TYPE
- See Also:
- Constant Field Values
-
MAX_ARRAY_TYPE
public static final int MAX_ARRAY_TYPE
- See Also:
- Constant Field Values
-
INVALID_DATATYPE
public static final CIMDataType INVALID_DATATYPE
-
NULL_DATATYPE
public static final CIMDataType NULL_DATATYPE
-
-
Constructor Detail
-
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- Throws:
java.lang.IllegalArgumentException
- if the specified data type is invalid
-
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 classpSize
- The desirtd size SIZE_UNLIMITED, 0..MAX_INT_SIZE- Throws:
java.lang.IllegalArgumentException
- if the data type is invalid or if the size is invalid.
-
CIMDataType
public CIMDataType(java.lang.String pRefClassName)
Construct a CIMDataType which is a references of the specified CIMClass.- Parameters:
pRefClassName
- The referenced class' name
-
CIMDataType
public CIMDataType(java.lang.String pRefClassName, int pSize)
Construct a CIMDataType which is an array of references of the specified CIMClass.- Parameters:
pRefClassName
- The referenced class' namepSize
- The size of the array
-
-
Method Detail
-
getRefClassName
public java.lang.String getRefClassName()
Returns the class name pointed by this data type.- Returns:
- The referenced class' name
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
getType
public int getType()
Returns the type of this object.- Returns:
- The type
-
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- Throws:
java.lang.IllegalArgumentException
- if the assigned data type is invalid
-
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.
-
findType
public static int findType(java.lang.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(java.lang.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
-
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
-
isTypeCompatible
public static boolean isTypeCompatible(java.lang.Object pValue, CIMDataType pDataType)
Defermines if the specified data type is is compatible with the data type of the specified value.- Parameters:
pValue
- The valuepDataType
- The data type- Returns:
true
, if compatible,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
-
clone
public java.lang.Object clone()
- Overrides:
clone
in classjava.lang.Object
-
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.
-
getStringType
public java.lang.String getStringType()
Returns the string representation of this type.- Returns:
- The string representation
-
toMOF
public java.lang.String toMOF()
Returns the MOF representation of this object.- Returns:
- Teh MOF representation
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
main
public static void main(java.lang.String[] args)
-
-