Class HxmProperty

java.lang.Object
com.hexaly.modeler.HxmProperty
All Implemented Interfaces:
AutoCloseable

public class HxmProperty extends Object implements 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

    Modifier and Type
    Method
    Description
    void
    Releases the reference.
    boolean
     
    boolean
    Returns the value of this property associated with the object given in parameter as a boolean.
    Returns the value of this property associated with the object given in parameter as a class.
    double
    Returns the value of this property associated with the object given in parameter as a double.
    Returns the value of this property associated with the object given in parameter as an expression.
    Returns the value of this property associated with the object given in parameter as a function.
    long
    Returns the value of this property associated with the object given in parameter as an integer.
    Returns the value of this property associated with the object given in parameter as a map.
    Returns the value of this property associated with the object given in parameter as a module.
    Returns the value of this property associated with the object given in parameter as a string.
    Returns the value of this property associated with the object given in parameter.
    int
     
    boolean
    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
    Sets the value of this property for the object given in parameter.
    void
    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
    Sets the value of this property for the object given in parameter.
    void
    setString(HxmValue obj, 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 Details

    • 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 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • getString

      public 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • setString

      public void setString(HxmValue obj, 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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 Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object