jfun.yan.xml.nuts.optional
Class SwitchNut
java.lang.Object
jfun.yan.xml.nut.Nut
jfun.yan.xml.nut.ComponentNut
jfun.yan.xml.nuts.optional.SwitchNut
- All Implemented Interfaces:
- java.io.Serializable
public class SwitchNut
- extends ComponentNut
The switch-case tag that supports <case> and <default> sub-tags.
It takes similar syntax and semantics as Java switch-case statement. for example:
<switch val="1">
<case of="1">
<return val="one"/>
</case>
<case of="2">
<fail msg="this is so wrong!"/>
</case>
<default>
<pring msg="did not find a match"/>
</default>
</switch>
Unlike Java, there's no fall-through behavior. And if default branch is not specified
and no match is found, it silently returns.
- Author:
- Ben Yu
Nov 11, 2005 3:46:03 PM
- See Also:
- Serialized Form
| Methods inherited from class jfun.yan.xml.nut.Nut |
cast, checkDuplicate, checkMandatory, checkMandatory, convert, getComponentClassLoader, getId, getNutClassLoader, getNutEnvironment, getParameterWiring, getPropertyWiring, getSequenceNumber, getTagLocation, getTagName, initGloballyDefined, initNutEnvironment, initSequenceNumber, initTagLocation, initTagName, isGloballyDefined, raise, raise, register, registerEagerInstantiation, setId, toString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
SwitchNut
public SwitchNut()
getVal
public java.lang.Object getVal()
setVal
public void setVal(java.lang.Object val)
addCase
public void addCase(Case cs)
addDefault
public void addDefault(Default def)
eval
public Component eval()
- Specified by:
eval in class ComponentNut