Package de.unibamberg.minf.gtf.commands
Class BaseCommandDispatcher
java.lang.Object
de.unibamberg.minf.gtf.commands.BaseCommands
de.unibamberg.minf.gtf.commands.BaseCommandDispatcher
- All Implemented Interfaces:
CommandDispatcher,Commands
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class -
Field Summary
Fields inherited from class de.unibamberg.minf.gtf.commands.BaseCommands
SIMPLE_TYPES -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> SyntaxTreeNodeconvert(T c) Override this method in any dispatcher that supports itself conversion of a type; throws DataTransformationException if called with unsupported typefinal Objectexecute(String command, Object[] args, ExecutionContext exectionContext) protected ObjectexecuteDirect(String command, Object[] args, ExecutionContext exectionContext) This method needs to be overridden in any dispatcher that handles commands itself, not only by further dispatching the command to subordinate dispatchersfindExecutingDispatcher(String command) This methods needs to be overridden in any dispatcher that has subordinate dispatchers that handle commandssupports(String command, Object[] args, ExecutionContext exectionContext) booleansupportsConversion(Class<?> c) Override this and enable for classes that are supported by this (not subordinate) dispatchersupportsDirect(String command, Object[] args, ExecutionContext exectionContext) This is a convenience implementation that acknowledges support of any provided simple or tree parameter array Override and customize in real implementations ofCommandDispatcherMethods inherited from class de.unibamberg.minf.gtf.commands.BaseCommands
convert, ensureCollection, ensureCollection, ensureCollectionSize, ensureCollectionSize, ensureCollectionSizeAtLeast, flattenArgs, getAsSimpleValue, getAsSimpleValue, getConversionSupportingDispatcher, getEnclosedType, getSubordinateDispatchers, isCollectionType, isNullValueMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.unibamberg.minf.gtf.commands.Commands
convert, ensureCollection, ensureCollection, ensureCollectionSize, ensureCollectionSize, ensureCollectionSizeAtLeast, flattenArgs, getAsSimpleValue, getAsSimpleValue, getConversionSupportingDispatcher, getEnclosedType, getSubordinateDispatchers, isCollectionType, isNullValue
-
Constructor Details
-
BaseCommandDispatcher
public BaseCommandDispatcher()
-
-
Method Details
-
execute
public final Object execute(String command, Object[] args, ExecutionContext exectionContext) throws CommandExecutionException - Specified by:
executein interfaceCommandDispatcher- Throws:
CommandExecutionException
-
supports
public final List<Boolean> supports(String command, Object[] args, ExecutionContext exectionContext) throws CommandExecutionException - Specified by:
supportsin interfaceCommandDispatcher- Throws:
CommandExecutionException
-
supportsDirect
public List<Boolean> supportsDirect(String command, Object[] args, ExecutionContext exectionContext) throws CommandExecutionException This is a convenience implementation that acknowledges support of any provided simple or tree parameter array Override and customize in real implementations ofCommandDispatcher- Specified by:
supportsDirectin interfaceCommandDispatcher- Throws:
CommandExecutionException
-
executeDirect
protected Object executeDirect(String command, Object[] args, ExecutionContext exectionContext) throws CommandExecutionException This method needs to be overridden in any dispatcher that handles commands itself, not only by further dispatching the command to subordinate dispatchers- Parameters:
command- Command to executeargs- Execution arguments- Returns:
- Execution result
- Throws:
CommandExecutionException
-
findExecutingDispatcher
This methods needs to be overridden in any dispatcher that has subordinate dispatchers that handle commands- Parameters:
command- Command to dispatch- Returns:
-
convert
Description copied from class:BaseCommandsOverride this method in any dispatcher that supports itself conversion of a type; throws DataTransformationException if called with unsupported type- Specified by:
convertin interfaceCommands- Overrides:
convertin classBaseCommands- Parameters:
c- Object to convert- Returns:
- ConvertedSyntaxTreeNode
- Throws:
DataTransformationException
-
supportsConversion
Description copied from class:BaseCommandsOverride this and enable for classes that are supported by this (not subordinate) dispatcher- Specified by:
supportsConversionin interfaceCommands- Overrides:
supportsConversionin classBaseCommands- Parameters:
c- possible class types- Returns:
- true if type conversion supported
-