All Superinterfaces:
Entity, Resource, Serializable
All Known Subinterfaces:
BooleanAttribute, DateAttribute, MultiValueListAttribute, NumericAttribute, ScriptAttribute, SingleValueListAttribute, StringAttribute

public interface Attribute extends Resource
Abstract super class for attributes
  • Method Details

    • getType

      Returns the attribute type for this attribute.
      Returns:
      the attribute type for this attribute
    • getAsset

      Returns the asset this attribute belongs to.
      Returns:
      the asset this attribute belongs to
    • getValue

      Object getValue()
      Returns the value of this attribute. Class of the returned object depends on the type of the attribute. Following list presents class of the value depending on the kind of the attribute

      When retrieving attributes of a known kind it's safe to cast the value to the required class or use getValueAs(Class) method passing the correct class of the attribute value. To dynamically check the kind of attribute it is possible to i.e.:

       
       if(attribute instanceof NumericAttribute) {
            Double value = attribute.getValueAs(Double.class);
       }
       
      or
       
       if(attribute.getType().getResourceType() == NumericAttribute) {
            Double value = attribute.getValueAs(Double.class);
       }
       
      Returns:
      the value of this attribute
    • getValueAs

      <T> T getValueAs(Class<T> clazz)
      Returns the value of this attribute casted to the class required by the parameter. Class of the returned object depends on the type of the attribute. Following list presents class of the value depending on the kind of the attribute

      When retrieving attributes of a known kind it's safe to cast the value to the required class or use getValueAs(Class) method passing the correct class of the attribute value. To dynamically check the kind of attribute it is possible to i.e.:

       
       if(attribute instanceof NumericAttribute) {
            Double value = attribute.getValueAs(Double.class);
       }
       
      or
       
       if(attribute.getType().getResourceType() == NumericAttribute) {
            Double value = attribute.getValueAs(Double.class);
       }
       
      Returns:
      the value of this attribute
    • getValueAsString

      String getValueAsString()
      Returns the value of this attribute represented as a String. Values of MultiValueListAttribute are represented as a ';' separated String
      Returns:
      the value of this attribute as a String
    • getAttributeDiscriminator

      String getAttributeDiscriminator()
      Returns the discriminator of this Attribute, which indicates the type. The value can be one of : NumericAttribute, ScriptAttribute, SingleValueListAttribute, DateAttribute, StringAttribute, BooleanAttribute or MultiValueListAttribute.
      Returns:
      the attribute discriminator