There is currently no instanceof operator or function in EL, but it would be a good to add that. Go ahead and open an enhancement request.
- Konstantin
From: sapphire-dev-bounces@xxxxxxxxxxx [mailto:sapphire-dev-bounces@xxxxxxxxxxx] On Behalf Of Shenxue Zhou
Sent: Thursday, July 14, 2011 3:00 PM
To: Sapphire project
Subject: [sapphire-dev] _expression_ based on element type
I need to write an _expression_ based on element type so that a diagram node can have different images depending on the element type. Here is my property:
// *** TaskFlowReference ***
@Type
(
base = ITaskFlowReference.class,
possible =
{
IStaticTaskFlowReference.class,
IDynamicTaskFlowReference.class
}
)
@Label( standard = "task flow reference" )
@XmlElementBinding
(
mappings =
{
@XmlElementBinding.Mapping( element = "task-flow-reference", type = IStaticTaskFlowReference.class ),
@XmlElementBinding.Mapping( element = "dynamic-task-flow-reference", type = IDynamicTaskFlowReference.class )
}
)
ElementProperty PROP_TASK_FLOW_REFERENCE = new ElementProperty( TYPE, "TaskFlowReference" );
I'd like to have something like the following to represent my node image id:
${TaskFlowReference instanceof IStaticTaskFlowReference ? (((IStaticTaskFlowReference)TaskFlow).Id != null ? completeTFCallIcon : incompleteTFCallIcon) : incompleteTFCallIcon}
Is this possible with the built in Sappire _expression_ support or I'd need to write a custom function?