Class Property


  • public class Property
    extends java.lang.Object
    Contains a property value. The value can be fetched as a generic Object or one of the convenience asXXXX methods can be used to get the value in a specific type. Copyright (c) DeviceAtlas Limited 2023. All Rights Reserved.
    • Constructor Summary

      Constructors 
      Constructor Description
      Property​(java.lang.Object value, byte dataTypeId)
      Create a new Property with a value and data type.
      Property​(java.lang.Object value, byte dataTypeId, boolean isCollectionOfValues)
      Create a new Property with a value and data type.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean asBoolean()
      Get the value of the property as a boolean.
      int asInteger()
      Get the value of the property as an int.
      java.util.Set asSet()
      Gets a set of possible values for this property.
      java.lang.String asString()
      Get the value of the property as a String.
      boolean equals​(java.lang.Object obj)
      Check if another object is equal to this object.
      java.lang.String getDataType()
      Get the data type name for values associated with this Property
      byte getDataTypeId()
      Get the data type ID for values associated with this Property
      int hashCode()  
      java.lang.String toString()
      Get the value of the property as a String.
      java.lang.Object value()
      Get the value Object.
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Property

        public Property​(java.lang.Object value,
                        byte dataTypeId)
        Create a new Property with a value and data type.
        Parameters:
        value - The value to store
        dataTypeId - The type of the value to store. Data typess are defined in class DataType.
      • Property

        public Property​(java.lang.Object value,
                        byte dataTypeId,
                        boolean isCollectionOfValues)
        Create a new Property with a value and data type.
        Parameters:
        value - The value to store
        dataTypeId - The type of the value to store. Data typess are defined in class DataType.
        isCollectionOfValues - Indicates if the Property will contain a single value or multiple values
    • Method Detail

      • getDataTypeId

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

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

        public java.lang.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 java.lang.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 java.lang.Object
        Returns:
        The String value of the property
      • asString

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

        public java.util.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 tyoe.
        Returns:
        A set of values.
      • equals

        public boolean equals​(java.lang.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 java.lang.Object
        Parameters:
        obj - object to be compared against
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object