Package com.hexaly.modeler
Class HxmField
- java.lang.Object
-
- com.hexaly.modeler.HxmField
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class HxmField extends java.lang.Object implements java.lang.AutoCloseable
An HxmField represents a field belonging to a modeler class. It can be used to get or set the value of a field on objects of the associated class.
Unlike properties, fields are always readable and writable. Furthermore, modifying or reading a field has no side-effects other than changing a value.
HxmFields are not modeler objects: they are merely descriptions that tell the modeler how to modify the fields of a class. They cannot be transformed into modeler values. However, the lifetime of fields follows the same logic as the other concepts and objects described in this API: you must release HxmFields by calling
close()
or usingHxmReferenceScope
.- 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 field associated with the object given in parameter as a boolean.HxmClass
getClass(HxmValue obj)
Returns the value of this field associated with the object given in parameter as a class.double
getDouble(HxmValue obj)
Returns the value of this field associated with the object given in parameter as a double.HxExpression
getExpression(HxmValue obj)
Returns the value of this field associated with the object given in parameter as an expression.HxmFunction
getFunction(HxmValue obj)
Returns the value of this field associated with the object given in parameter as a function.long
getInt(HxmValue obj)
Returns the value of this field associated with the object given in parameter as an integer.HxmMap
getMap(HxmValue obj)
Returns the value of this field associated with the object given in parameter as a map.HxmModule
getModule(HxmValue obj)
Returns the value of this field associated with the object given in parameter as a module.java.lang.String
getString(HxmValue obj)
Returns the value of this field associated with the object given in parameter as a string.HxmValue
getValue(HxmValue obj)
Returns the value of this field associated with the object given in parameter.int
hashCode()
void
setBool(HxmValue obj, boolean value)
Sets the value of this field for the object given in parameter.void
setClass(HxmValue obj, HxmClass clazz)
Sets the value of this field for the object given in parameter.void
setDouble(HxmValue obj, double value)
Sets the value of this field for the object given in parameter.void
setExpression(HxmValue obj, HxExpression expr)
Sets the value of this field for the object given in parameter.void
setFunction(HxmValue obj, HxmFunction function)
Sets the value of this field for the object given in parameter.void
setInt(HxmValue obj, long value)
Sets the value of this field for the object given in parameter.void
setMap(HxmValue obj, HxmMap map)
Sets the value of this field for the object given in parameter.void
setModule(HxmValue obj, HxmModule module)
Sets the value of this field for the object given in parameter.void
setString(HxmValue obj, java.lang.String value)
Sets the value of this field for the object given in parameter.void
setValue(HxmValue obj, HxmValue value)
Sets the value of this field for the object given in parameter.
-
-
-
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 interfacejava.lang.AutoCloseable
-
getValue
public HxmValue getValue(HxmValue obj)
Returns the value of this field associated with the object given in parameter. The object passed in parameter must be an instance of the class to which this field belongs.- Parameters:
obj
- Object on which to retrieve the field.- Returns:
- Value of the field on the given object.
- See Also:
HxmValue
-
getInt
public long getInt(HxmValue obj)
Returns the value of this field 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 field belongs.- Parameters:
obj
- Object on which to retrieve the field.- Returns:
- Value of the field on the given object.
- See Also:
HxmValue
-
getDouble
public double getDouble(HxmValue obj)
Returns the value of this field 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 field belongs.- Parameters:
obj
- Object on which to retrieve the field.- Returns:
- Value of the field on the given object.
- See Also:
HxmValue
-
getBool
public boolean getBool(HxmValue obj)
Returns the value of this field 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 field belongs.- Parameters:
obj
- Object on which to retrieve the field.- Returns:
- Value of the field on the given object.
- See Also:
HxmValue
-
getExpression
public HxExpression getExpression(HxmValue obj)
Returns the value of this field 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 field belongs.- Parameters:
obj
- Object on which to retrieve the field.- Returns:
- Value of the field on the given object.
- See Also:
HxmValue
,HxExpression
-
getString
public java.lang.String getString(HxmValue obj)
Returns the value of this field 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 field belongs.- Parameters:
obj
- Object on which to retrieve the field.- Returns:
- Value of the field on the given object.
- See Also:
HxmValue
-
getModule
public HxmModule getModule(HxmValue obj)
Returns the value of this field 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 field belongs.
-
getMap
public HxmMap getMap(HxmValue obj)
Returns the value of this field 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 field belongs.
-
getFunction
public HxmFunction getFunction(HxmValue obj)
Returns the value of this field 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 field belongs.- Parameters:
obj
- Object on which to retrieve the field.- Returns:
- Value of the field on the given object.
- See Also:
HxmValue
,HxmFunction
-
getClass
public HxmClass getClass(HxmValue obj)
Returns the value of this field 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 field belongs.
-
setValue
public void setValue(HxmValue obj, HxmValue value)
Sets the value of this field for the object given in parameter. The object passed in parameter must be an instance of the class to which this field belongs.- Parameters:
obj
- Object on which to change the field value.value
- New value of the field.- See Also:
HxmValue
-
setInt
public void setInt(HxmValue obj, long value)
Sets the value of this field for the object given in parameter. The object passed in parameter must be an instance of the class to which this field belongs.- Parameters:
obj
- Object on which to change the field value.value
- New value of the field.- See Also:
HxmValue
-
setDouble
public void setDouble(HxmValue obj, double value)
Sets the value of this field for the object given in parameter. The object passed in parameter must be an instance of the class to which this field belongs.- Parameters:
obj
- Object on which to change the field value.value
- New value of the field.- See Also:
HxmValue
-
setBool
public void setBool(HxmValue obj, boolean value)
Sets the value of this field for the object given in parameter. The object passed in parameter must be an instance of the class to which this field belongs.- Parameters:
obj
- Object on which to change the field value.value
- New value of the field.- See Also:
HxmValue
-
setExpression
public void setExpression(HxmValue obj, HxExpression expr)
Sets the value of this field for the object given in parameter. The object passed in parameter must be an instance of the class to which this field belongs.- Parameters:
obj
- Object on which to change the field value.expr
- New value of the field.- See Also:
HxmValue
,HxExpression
-
setString
public void setString(HxmValue obj, java.lang.String value)
Sets the value of this field for the object given in parameter. The object passed in parameter must be an instance of the class to which this field belongs.- Parameters:
obj
- Object on which to change the field value.value
- New value of the field.- See Also:
HxmValue
-
setModule
public void setModule(HxmValue obj, HxmModule module)
Sets the value of this field for the object given in parameter. The object passed in parameter must be an instance of the class to which this field belongs.
-
setMap
public void setMap(HxmValue obj, HxmMap map)
Sets the value of this field for the object given in parameter. The object passed in parameter must be an instance of the class to which this field belongs.
-
setFunction
public void setFunction(HxmValue obj, HxmFunction function)
Sets the value of this field for the object given in parameter. The object passed in parameter must be an instance of the class to which this field belongs.- Parameters:
obj
- Object on which to change the field value.function
- New value of the field.- See Also:
HxmValue
,HxmFunction
-
setClass
public void setClass(HxmValue obj, HxmClass clazz)
Sets the value of this field for the object given in parameter. The object passed in parameter must be an instance of the class to which this field belongs.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-