Class AbstractExtensibleRepresentation

java.lang.Object
com.cumulocity.rest.representation.BaseResourceRepresentation
com.cumulocity.rest.representation.AbstractExtensibleRepresentation
All Implemented Interfaces:
ResourceRepresentation, org.svenson.DynamicProperties
Direct Known Subclasses:
AlarmsApiRepresentation, ApplicationReferenceRepresentation, ApplicationRepresentation, ApplicationUserRepresentation, ApplicationVersionRepresentation, AuditRecordsRepresentation, BaseResourceWithExplainRepresentation, ChangeRepresentation, ConfigurationOptionRepresentation, ConfigurationOptionSchemaRepresentation, CurrentUserRepresentation, DeliveryLogEntryRepresentation, DeliveryRepresentation, DeviceControlRepresentation, EmailRepresentation, ErrorMessageRepresentation, EventRepresentation, EventsApiRepresentation, ExtensibleOptionRepresentation, ExtensionRepresentation, ExternalIDRepresentation, GroupReferenceRepresentation, IdentityRepresentation, InventoryRepresentation, ManagedObjectReferenceRepresentation, ManagedObjectRepresentation, ManifestRepresentation, MeasurementRepresentation, MeasurementsApiRepresentation, MicroserviceBillingRepresentation, NotificationSubscriptionFilterRepresentation, NotificationSubscriptionRepresentation, NotificationTokenRequestRepresentation, OperationRepresentation, OptionRepresentation, OptionsRepresentation, PageStatisticsRepresentation, PlatformApiRepresentation, ProbeRepresentation, ProbeRepresentation.ExecActionRepresentation, ProbeRepresentation.HTTPGetActionRepresentation, ProbeRepresentation.HttpHeaderRepresentation, ProbeRepresentation.TCPSocketActionRepresentation, ProviderRepresentation, ResourcesRepresentation, RoleReferenceRepresentation, RoleRepresentation, SupportedMeasurementsRepresentation, SupportedSeriesRepresentation, SupportUserDetailsRepresentation, TenantApiRepresentation, TenantReferenceRepresentation, UserReferenceRepresentation, UsersApiRepresentation

public class AbstractExtensibleRepresentation extends BaseResourceRepresentation implements org.svenson.DynamicProperties
  • Constructor Details

    • AbstractExtensibleRepresentation

      public AbstractExtensibleRepresentation()
  • Method Details

    • getAttrs

      @JSONProperty(ignore=true) public Map<String,Object> getAttrs()
    • setAttrs

      public void setAttrs(Map<String,Object> attrs)
    • getProperty

      public Object getProperty(String name)
      Specified by:
      getProperty in interface org.svenson.DynamicProperties
    • setProperty

      public void setProperty(String name, Object value)
      Specified by:
      setProperty in interface org.svenson.DynamicProperties
    • removeProperty

      public Object removeProperty(String name)
      Specified by:
      removeProperty in interface org.svenson.DynamicProperties
    • hasProperty

      public boolean hasProperty(String name)
      Specified by:
      hasProperty in interface org.svenson.DynamicProperties
    • propertyNames

      public Set<String> propertyNames()
      Specified by:
      propertyNames in interface org.svenson.DynamicProperties
    • set

      @JSONProperty(ignore=true) public void set(Object object)
      Sets a property referring to the given object. The name of the property will be the fully qualified class name with dots replaced by underscores.
      For example, if the object is of type:
      • com.cumulocity.model.Coordinate
      then the property name will be:
      • "com_cumulocity_model_Coordinate"
      Parameters:
      object - an object to set
    • set

      @JSONProperty(ignore=true) public void set(Object object, String propertyName)
      Sets a property referring to the given object, using an arbitrary property name.
      Parameters:
      object - property value
      propertyName - property name
    • set

      @JSONProperty(ignore=true) public <T> void set(Object object, Class<T> clazz)
      Sets a property referring to the given object. The name of the property will be the fully qualified class name of the given class, with dots replaced by underscores.
      This can be useful if you want to name the property after the base class rather than the actual class of object.
      For example, if clazz is of type:
      • com.cumulocity.model.Coordinate
      then the property name will be:
      • "com_cumulocity_model_Coordinate"
      Type Parameters:
      T - generic type of the class
      Parameters:
      object - object to set
      clazz - object class
    • get

      public <T> T get(Class<T> clazz)
      Returns the object whose parameter name is given by clazz, or null if no such property exists, or it is invalid.
      Type Parameters:
      T - generic type fo the class
      Parameters:
      clazz - a class of the property
      Returns:
      property value
      See Also:
    • get

      public Object get(String name)
      Returns the object associated with the given property name, or null if no such property exists.
      Parameters:
      name - property name
      Returns:
      value of the property