Package gda.spring.spel
Class SpringExpressionLinkedField
java.lang.Object
org.eclipse.scanning.api.AbstractNameable
org.eclipse.scanning.device.AbstractMetadataNode
org.eclipse.scanning.device.LinkedField
gda.spring.spel.SpringExpressionLinkedField
- All Implemented Interfaces:
INameable,MetadataNode
A
MetadataNode that add a link to a DataNode at a path calculated from a given Spring Expression.
If the evaluation of the expression fails, it will return the error message instead.
The expression is designed to support objects as well as object defined in Jython Name Space in GDA.
It also support a list of SpEL-functions defined in SpELUtils class. SpEL functions when used must be defined in a Map
with the entry key to be the name of the method, the entry value to be a list of fully qualified class names.
Example of usage in bean definition:
<bean class="gda.spring.spel.SpringExpressionLinkedField" init-method="init">
<property name="name" value="energy"/>
<property name="expression" value="(100.0 - @iddgap.getPosition()) > 2.0 ? '/entry/instrument/id/idd/energy' : '/entry/instrument/id/idu/energy'"/>
</bean>
where '@iddgap' is a reference to a scannable instance defined in SpEL object format.- Since:
- 9.37
-
Constructor Summary
ConstructorsConstructorDescriptionSpringExpressionLinkedField(String fieldName, String expression) SpringExpressionLinkedField(String fieldName, String externalFilePath, String expression) -
Method Summary
Modifier and TypeMethodDescriptionvoidinit()voidsetExpression(String expression) voidsetFunctionNamesParameterTypes(Map<String, List<Class<?>>> functionNamesParameterTypes) Methods inherited from class org.eclipse.scanning.device.LinkedField
getExternalFilePath, getLinkPath, setExternalFilePath, setLinkPathMethods inherited from class org.eclipse.scanning.device.AbstractMetadataNode
addAttribute, addAttributes, clearAttributes, createAttributes, createNode, handleError, hasAttributes, removeAttribute, setAttributesMethods inherited from class org.eclipse.scanning.api.AbstractNameable
equals, getName, hashCode, setName, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.scanning.device.MetadataNode
isDefaultValue
-
Constructor Details
-
SpringExpressionLinkedField
public SpringExpressionLinkedField() -
SpringExpressionLinkedField
-
SpringExpressionLinkedField
-
-
Method Details
-
init
-
doCreateNode
- Overrides:
doCreateNodein classLinkedField- Throws:
NexusException
-
getFunctionNamesParameterTypes
-
setFunctionNamesParameterTypes
-
getExpression
-
setExpression
-