Class AbstractExtensibleRepresentation

    • Constructor Detail

      • AbstractExtensibleRepresentation

        public AbstractExtensibleRepresentation()
    • Method Detail

      • getAttrs

        @JSONProperty(ignore=true)
        public Map<String,​Object> getAttrs()
      • 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:
        set(Object)
      • 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