Class Property

java.lang.Object
com.deviceatlas.Property

public class Property extends Object
Contains a property value. The value can be fetched as a generic Object or one of the convenience methods can be used to get the value in a specific type.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Get the value of the property as a boolean.
    int
    Get the value of the property as an int.
    Set<?>
    Gets a set of possible values for this property.
    Get the value of the property as a String.
    boolean
    Check if another object is equal to this object.
    Get the data type name for values associated with this Property
    byte
    Get the data type ID for values associated with this Property
    int
     
    Get the value of the property as a String.
    Get the value Object.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Method Details

    • getDataTypeId

      public byte getDataTypeId()
      Get the data type ID for values associated with this Property
      Returns:
      The ID of the data type
    • getDataType

      public String getDataType()
      Get the data type name for values associated with this Property
      Returns:
      The name of the data type
    • value

      public Object value()
      Get the value Object. This needs to be cast to the appropriate type such as Integer to be used. E.g. Integer value = (Integer)property.value();
      Returns:
      The raw Object value.
    • toString

      public String toString()
      Get the value of the property as a String. Alias for asString() . If a property has multiple possible values then the values are concatenated with a comma.
      Overrides:
      toString in class Object
      Returns:
      The String value of the property
    • asString

      public String asString()
      Get the value of the property as a String. Alias for toString() .
      Returns:
      The String value of the property
    • asBoolean

      public boolean asBoolean() throws IncorrectPropertyTypeException
      Get the value of the property as a boolean.
      Returns:
      The boolean value of the property
      Throws:
      IncorrectPropertyTypeException - Thrown if the type of the value is not a DataType.BOOLEAN
    • asInteger

      public int asInteger() throws IncorrectPropertyTypeException
      Get the value of the property as an int.
      Returns:
      The integer value of the property.
      Throws:
      IncorrectPropertyTypeException - Thrown if the type of the value is not compatible with a DataType.INTEGER
    • asSet

      public Set<?> asSet()
      Gets a set of possible values for this property. This is typically only used when it is known that a given property name can have multiple possible values. All items in the set will have the same data type.
      Returns:
      A set of values.
    • equals

      public boolean equals(Object obj)
      Check if another object is equal to this object. It must have the same interface, data type and value.
      Overrides:
      equals in class Object
      Parameters:
      obj - object to be compared against
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object