Package org.jclouds.scriptbuilder.domain
Class SwitchArg
- java.lang.Object
 - 
- org.jclouds.scriptbuilder.domain.SwitchArg
 
 
- 
- All Implemented Interfaces:
 AcceptsStatementVisitor,Statement
public class SwitchArg extends Object implements Statement, AcceptsStatementVisitor
Statement used in a shell script 
- 
- 
Field Summary
Fields Modifier and Type Field Description static Map<OsFamily,String>OS_TO_CASE_PATTERNstatic Map<OsFamily,String>OS_TO_END_SWITCH_PATTERNstatic Map<OsFamily,String>OS_TO_SWITCH_PATTERN 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(StatementVisitor visitor)booleanequals(Object obj)Iterable<String>functionDependencies(OsFamily family)inthashCode()Stringrender(OsFamily family) 
 - 
 
- 
- 
Constructor Detail
- 
SwitchArg
public SwitchArg(int arg, Map<String,Statement> valueToActions)Generates a switch statement based onarg. If its value is found to be a key invalueToActions, the corresponding action is invoked. Ex. arg is1- the first argument to the script
and valueToActions is {"start" -> "echo hello", "stop" -> "echo goodbye"}
the script created will respond accordingly:
./script start
<< returns hello
./script stop
<< returns goodbye- Parameters:
 arg- - shell arg to switch onvalueToActions- - case statements, if the value of the arg matches a key, the corresponding value will be invoked.
 
 - 
 
- 
Method Detail
- 
functionDependencies
public Iterable<String> functionDependencies(OsFamily family)
- Specified by:
 functionDependenciesin interfaceStatement
 
- 
accept
public void accept(StatementVisitor visitor)
- Specified by:
 acceptin interfaceAcceptsStatementVisitor
 
 - 
 
 -