Class DataValue

java.lang.Object
net.aifusion.metamodel.DataValue

public class DataValue extends Object
This class encapsulates all CIM data values
Author:
Sharad Singhal
  • Constructor Details

    • DataValue

      public DataValue(Object value)
      Create a data dataValue from some java object
      Parameters:
      value - - java dataValue to be encapsulated. Can be any type defined in DataType
      Throws:
      ModelException - if given java object is null, or does not represent a valid CIM data type
      See Also:
    • DataValue

      public DataValue(DataType type, Object value)
      Create a data dataValue from the given type and dataValue
      Parameters:
      type - - expected data type
      value - - java object of the expected data type (may be null)
      Throws:
      ModelException - if type is null, or dataValue does not match type
      See Also:
    • DataValue

      public DataValue(String type, String value)
      Create a data dataValue from a given component type and dataValue
      Parameters:
      type - - string containing expected data type
      value - - string containing the expected data dataValue
      Throws:
      ModelException - if type is null or an array type, or if the given string value cannot be converted to the corresponding type
      See Also:
    • DataValue

      public DataValue(String type, String[] value)
      Create a data dataValue from an array of string values
      Parameters:
      type - - string containing expected array type
      value - - array containing string representations of the expected values
      Throws:
      ModelException - if type is null or a component type, or if dataValue cannot be converted to the given type
  • Method Details

    • getType

      public DataType getType()
      Get the type of the data dataValue
      Returns:
      - CIM data type for this dataValue
    • getValue

      public Object getValue()
      Get the java value in this dataValue. Note that for array values, a shallow copy of the underlying array is returned
      Returns:
      - value encapsulated in this dataValue
    • toMOF

      public String toMOF()
      Get the MOF representation of this data dataValue
      Returns:
      - string containing the MOF representation of this data dataValue
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object