Class HxmProperty

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class HxmProperty
    extends java.lang.Object
    implements java.lang.AutoCloseable

    An HxmProperty represents a property belonging to a modeler class. It can be used to get or set the value of a property on objects of the associated class.

    Unlike fields, properties do not have an actual value and can be readonly. The value is represented by two functions: a getter function and a setter function which can be absent.

    HxmProperty are not modeler objects: they are merely descriptions that tell the modeler how to modify the properties of a class. They cannot be transformed into modeler values. However, the lifetime of properties follows the same logic as the other concepts and objects described in this API: you must release HxmPropertys by calling close() or using HxmReferenceScope.

    Since:
    13.0
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Releases the reference.
      boolean equals​(java.lang.Object obj)  
      boolean getBool​(HxmValue obj)
      Returns the value of this property associated with the object given in parameter as a boolean.
      HxmClass getClass​(HxmValue obj)
      Returns the value of this property associated with the object given in parameter as a class.
      double getDouble​(HxmValue obj)
      Returns the value of this property associated with the object given in parameter as a double.
      HxExpression getExpression​(HxmValue obj)
      Returns the value of this property associated with the object given in parameter as an expression.
      HxmFunction getFunction​(HxmValue obj)
      Returns the value of this property associated with the object given in parameter as a function.
      long getInt​(HxmValue obj)
      Returns the value of this property associated with the object given in parameter as an integer.
      HxmMap getMap​(HxmValue obj)
      Returns the value of this property associated with the object given in parameter as a map.
      HxmModule getModule​(HxmValue obj)
      Returns the value of this property associated with the object given in parameter as a module.
      java.lang.String getString​(HxmValue obj)
      Returns the value of this property associated with the object given in parameter as a string.
      HxmValue getValue​(HxmValue obj)
      Returns the value of this property associated with the object given in parameter.
      int hashCode()  
      boolean isReadOnly()
      Returns true if this property is readonly.
      void setBool​(HxmValue obj, boolean value)
      Sets the value of this property for the object given in parameter.
      void setClass​(HxmValue obj, HxmClass clazz)
      Sets the value of this property for the object given in parameter.
      void setDouble​(HxmValue obj, double value)
      Sets the value of this property for the object given in parameter.
      void setExpression​(HxmValue obj, HxExpression expr)
      Sets the value of this property for the object given in parameter.
      void setFunction​(HxmValue obj, HxmFunction function)
      Sets the value of this property for the object given in parameter.
      void setInt​(HxmValue obj, long value)
      Sets the value of this property for the object given in parameter.
      void setMap​(HxmValue obj, HxmMap map)
      Sets the value of this property for the object given in parameter.
      void setModule​(HxmValue obj, HxmModule module)
      Sets the value of this property for the object given in parameter.
      void setString​(HxmValue obj, java.lang.String value)
      Sets the value of this property for the object given in parameter.
      void setValue​(HxmValue obj, HxmValue value)
      Sets the value of this property for the object given in parameter.
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • close

        public void close()
        Releases the reference. If this value was already released, returns immediately and does nothing. Invoking any method on this object after this operation will throw an exception.
        Specified by:
        close in interface java.lang.AutoCloseable
      • getValue

        public HxmValue getValue​(HxmValue obj)
        Returns the value of this property associated with the object given in parameter. The object passed in parameter must be an instance of the class to which this property belongs.
        Parameters:
        obj - Object on which to retrieve the property.
        Returns:
        Value of the property on the given object.
        See Also:
        HxmValue
      • getInt

        public long getInt​(HxmValue obj)
        Returns the value of this property associated with the object given in parameter as an integer. An exception will be thrown if the returned value is not an integer. The object passed in parameter must be an instance of the class to which this property belongs.
        Parameters:
        obj - Object on which to retrieve the property.
        Returns:
        Value of the property on the given object.
        See Also:
        HxmValue
      • getDouble

        public double getDouble​(HxmValue obj)
        Returns the value of this property associated with the object given in parameter as a double. An exception will be thrown if the returned value is not a double. The object passed in parameter must be an instance of the class to which this property belongs.
        Parameters:
        obj - Object on which to retrieve the property.
        Returns:
        Value of the property on the given object.
        See Also:
        HxmValue
      • getBool

        public boolean getBool​(HxmValue obj)
        Returns the value of this property associated with the object given in parameter as a boolean. An exception will be thrown if the returned value is not a boolean. The object passed in parameter must be an instance of the class to which this property belongs.
        Parameters:
        obj - Object on which to retrieve the property.
        Returns:
        Value of the property on the given object.
        See Also:
        HxmValue
      • getExpression

        public HxExpression getExpression​(HxmValue obj)
        Returns the value of this property associated with the object given in parameter as an expression. An exception will be thrown if the returned value is not an expression. The object passed in parameter must be an instance of the class to which this property belongs.
        Parameters:
        obj - Object on which to retrieve the property.
        Returns:
        Value of the property on the given object.
        See Also:
        HxmValue, HxExpression
      • getString

        public java.lang.String getString​(HxmValue obj)
        Returns the value of this property associated with the object given in parameter as a string. An exception will be thrown if the returned value is not a string. The object passed in parameter must be an instance of the class to which this property belongs.
        Parameters:
        obj - Object on which to retrieve the property.
        Returns:
        Value of the property on the given object.
        See Also:
        HxmValue
      • getModule

        public HxmModule getModule​(HxmValue obj)
        Returns the value of this property associated with the object given in parameter as a module. An exception will be thrown if the returned value is not a module. The object passed in parameter must be an instance of the class to which this property belongs.
        Parameters:
        obj - Object on which to retrieve the property.
        Returns:
        Value of the property on the given object.
        See Also:
        HxmValue, HxmModule
      • getMap

        public HxmMap getMap​(HxmValue obj)
        Returns the value of this property associated with the object given in parameter as a map. An exception will be thrown if the returned value is not a map. The object passed in parameter must be an instance of the class to which this property belongs.
        Parameters:
        obj - Object on which to retrieve the property.
        Returns:
        Value of the property on the given object.
        See Also:
        HxmValue, HxmMap
      • getFunction

        public HxmFunction getFunction​(HxmValue obj)
        Returns the value of this property associated with the object given in parameter as a function. An exception will be thrown if the returned value is not a function. The object passed in parameter must be an instance of the class to which this property belongs.
        Parameters:
        obj - Object on which to retrieve the property.
        Returns:
        Value of the property on the given object.
        See Also:
        HxmValue, HxmFunction
      • getClass

        public HxmClass getClass​(HxmValue obj)
        Returns the value of this property associated with the object given in parameter as a class. An exception will be thrown if the returned value is not a class. The object passed in parameter must be an instance of the class to which this property belongs.
        Parameters:
        obj - Object on which to retrieve the property.
        Returns:
        Value of the property on the given object.
        See Also:
        HxmValue, HxmClass
      • setValue

        public void setValue​(HxmValue obj,
                             HxmValue value)
        Sets the value of this property for the object given in parameter. The object passed in parameter must be an instance of the class to which this property belongs. An exception will be thrown if this property is read-only.
        Parameters:
        obj - Object on which to change the property value.
        value - New value of the property.
        See Also:
        HxmValue
      • setInt

        public void setInt​(HxmValue obj,
                           long value)
        Sets the value of this property for the object given in parameter. The object passed in parameter must be an instance of the class to which this property belongs. An exception will be thrown if this property is read-only.
        Parameters:
        obj - Object on which to change the property value.
        value - New value of the property.
        See Also:
        HxmValue
      • setDouble

        public void setDouble​(HxmValue obj,
                              double value)
        Sets the value of this property for the object given in parameter. The object passed in parameter must be an instance of the class to which this property belongs. An exception will be thrown if this property is read-only.
        Parameters:
        obj - Object on which to change the property value.
        value - New value of the property.
        See Also:
        HxmValue
      • setBool

        public void setBool​(HxmValue obj,
                            boolean value)
        Sets the value of this property for the object given in parameter. The object passed in parameter must be an instance of the class to which this property belongs. An exception will be thrown if this property is read-only.
        Parameters:
        obj - Object on which to change the property value.
        value - New value of the property.
        See Also:
        HxmValue
      • setExpression

        public void setExpression​(HxmValue obj,
                                  HxExpression expr)
        Sets the value of this property for the object given in parameter. The object passed in parameter must be an instance of the class to which this property belongs. An exception will be thrown if this property is read-only.
        Parameters:
        obj - Object on which to change the property value.
        expr - New value of the property.
        See Also:
        HxmValue, HxExpression
      • setString

        public void setString​(HxmValue obj,
                              java.lang.String value)
        Sets the value of this property for the object given in parameter. The object passed in parameter must be an instance of the class to which this property belongs. An exception will be thrown if this property is read-only.
        Parameters:
        obj - Object on which to change the property value.
        value - New value of the property.
        See Also:
        HxmValue
      • setModule

        public void setModule​(HxmValue obj,
                              HxmModule module)
        Sets the value of this property for the object given in parameter. The object passed in parameter must be an instance of the class to which this property belongs. An exception will be thrown if this property is read-only.
        Parameters:
        obj - Object on which to change the property value.
        module - New value of the property.
        See Also:
        HxmValue, HxmModule
      • setMap

        public void setMap​(HxmValue obj,
                           HxmMap map)
        Sets the value of this property for the object given in parameter. The object passed in parameter must be an instance of the class to which this property belongs. An exception will be thrown if this property is read-only.
        Parameters:
        obj - Object on which to change the property value.
        map - New value of the property.
        See Also:
        HxmValue, HxmMap
      • setFunction

        public void setFunction​(HxmValue obj,
                                HxmFunction function)
        Sets the value of this property for the object given in parameter. The object passed in parameter must be an instance of the class to which this property belongs. An exception will be thrown if this property is read-only.
        Parameters:
        obj - Object on which to change the property value.
        function - New value of the property.
        See Also:
        HxmValue, HxmFunction
      • setClass

        public void setClass​(HxmValue obj,
                             HxmClass clazz)
        Sets the value of this property for the object given in parameter. The object passed in parameter must be an instance of the class to which this property belongs. An exception will be thrown if this property is read-only.
        Parameters:
        obj - Object on which to change the property value.
        clazz - New value of the property.
        See Also:
        HxmValue, HxmClass
      • isReadOnly

        public boolean isReadOnly()
        Returns true if this property is readonly.
        Returns:
        True if this property is readonly.
      • hashCode

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

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object