Class 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
    • 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()  
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
    • 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 class
        pSize - 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' name
        pSize - 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 class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.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 value
        pDataType - The data type
        Returns:
        true, if compatible, falseotherwise
      • 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 class java.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 class java.lang.Object
      • main

        public static void main​(java.lang.String[] args)