Down-casts the item to specified type.
Namespace: com.mindfusion.diagramming
Package: com.mindfusion.diagramming
Java
![]() |
---|
public <T> T as ( |
A Class instance specifying the target type.
This item cast to specified type, or null if it's of a different type.
Syntax sugar for a slightly shorter type checking and casting.
Java
![]() |
---|
public void nodeCreated(NodeEvent e) { ContainerNode container = e.getNode().as(ContainerNode.class); if (container != null) { ... } } // alternative to public void nodeCreated(NodeEvent e) { if (e.getNode() instanceof ContainerNode) { ContainerNode container = (ContainerNode)e.getNode(); ... } } |