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 Summary
Constructors Constructor Description AbstractExtensibleRepresentation()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <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.Object
get(String name)
Returns the object associated with the given property name, or null if no such property exists.Map<String,Object>
getAttrs()
Object
getProperty(String name)
boolean
hasProperty(String name)
Set<String>
propertyNames()
Object
removeProperty(String name)
void
set(Object object)
Sets a property referring to the given object.<T> void
set(Object object, Class<T> clazz)
Sets a property referring to the given object.void
set(Object object, String propertyName)
Sets a property referring to the given object, using an arbitrary property name.void
setAttrs(Map<String,Object> attrs)
void
setProperty(String name, Object value)
-
Methods inherited from class com.cumulocity.rest.representation.BaseResourceRepresentation
getSelf, getSelfDecoded, setSelf, toJSON, toString
-
-
-
-
Method Detail
-
getProperty
public Object getProperty(String name)
- Specified by:
getProperty
in interfaceorg.svenson.DynamicProperties
-
setProperty
public void setProperty(String name, Object value)
- Specified by:
setProperty
in interfaceorg.svenson.DynamicProperties
-
removeProperty
public Object removeProperty(String name)
- Specified by:
removeProperty
in interfaceorg.svenson.DynamicProperties
-
hasProperty
public boolean hasProperty(String name)
- Specified by:
hasProperty
in interfaceorg.svenson.DynamicProperties
-
propertyNames
public Set<String> propertyNames()
- Specified by:
propertyNames
in interfaceorg.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
- "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 valuepropertyName
- 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
- "com_cumulocity_model_Coordinate"
- Type Parameters:
T
- generic type of the class- Parameters:
object
- object to setclazz
- 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:
set(Object)
-
-