org.peaseplate.internal.lang.command
Class AbstractObjectCallCommand
java.lang.Object
org.peaseplate.internal.lang.command.AbstractCommand
org.peaseplate.internal.lang.command.AbstractSingleParameterCommand
org.peaseplate.internal.lang.command.AbstractNativeCallCommand
org.peaseplate.internal.lang.command.AbstractObjectCallCommand
- All Implemented Interfaces:
- ICommand
- Direct Known Subclasses:
- InvocationCommand, QueryCommand
public abstract class AbstractObjectCallCommand
- extends AbstractNativeCallCommand
Method Summary |
protected java.lang.Object |
callArray(java.lang.Object[] onArray,
int index)
|
protected java.lang.Object |
callField(java.lang.Object onObject,
java.lang.reflect.Field field)
|
protected java.lang.Object |
callFieldOrMethod(BuildContext context,
java.lang.Object onObject,
java.lang.String identifier)
|
protected java.lang.Object |
callList(java.util.List<?> onList,
int index)
|
protected java.lang.Object |
callMap(BuildContext context,
java.util.Map<?,?> onMap,
java.lang.Object identifier)
|
protected java.lang.Object |
callMethod(BuildContext context,
java.lang.Object onObject,
java.lang.reflect.Method method)
|
protected java.lang.Object |
callMethod(BuildContext context,
java.lang.Object onObject,
java.lang.String identifier)
|
protected abstract java.lang.Object |
callObject(BuildContext context,
java.lang.Object onObject,
java.lang.Object identifier)
Distinguishes between maps, lists and other objects. |
protected java.lang.reflect.Field |
findField(java.lang.Class<?> clazz,
java.lang.String identifier)
|
protected abstract java.lang.reflect.Field |
getField(java.lang.Class<?> clazz,
java.lang.String identifier)
|
protected abstract java.lang.reflect.Method |
getMethod(java.lang.Class<?> clazz,
java.lang.String identifier,
int numberOfParameters)
|
protected java.lang.reflect.Field |
scanFields(java.lang.Class<?> clazz,
java.lang.String identifier)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.peaseplate.internal.lang.command.ICommand |
call |
AbstractObjectCallCommand
public AbstractObjectCallCommand(TemplateLocator locator,
int line,
int column,
ICommand command,
ICommand... parameterCommands)
callObject
protected abstract java.lang.Object callObject(BuildContext context,
java.lang.Object onObject,
java.lang.Object identifier)
throws TemplateRuntimeException
- Distinguishes between maps, lists and other objects.
If object is a map, it resolves the return value from the map.
If the object is a list and the identifier is a number, it resolves
the return value from the list.
If the object is an array and the identifier is a number, it resolves
the return value from the array.
In any other case, it invokes the method with the specified identifier
and the parameters on the object.
It depends on the call in which order the options are used.
- Parameters:
onObject
- the objectidentifier
- the name of the map entry, the index of the list, or the name of the method.parameters
- the parameters
- Returns:
- the result
- Throws:
TemplateRuntimeException
callField
protected java.lang.Object callField(java.lang.Object onObject,
java.lang.reflect.Field field)
throws TemplateRuntimeException
- Throws:
TemplateRuntimeException
callMap
protected java.lang.Object callMap(BuildContext context,
java.util.Map<?,?> onMap,
java.lang.Object identifier)
throws TemplateRuntimeException
- Throws:
TemplateRuntimeException
callList
protected java.lang.Object callList(java.util.List<?> onList,
int index)
throws TemplateRuntimeException
- Throws:
TemplateRuntimeException
callArray
protected java.lang.Object callArray(java.lang.Object[] onArray,
int index)
throws TemplateRuntimeException
- Throws:
TemplateRuntimeException
callFieldOrMethod
protected java.lang.Object callFieldOrMethod(BuildContext context,
java.lang.Object onObject,
java.lang.String identifier)
throws TemplateRuntimeException
- Throws:
TemplateRuntimeException
callMethod
protected java.lang.Object callMethod(BuildContext context,
java.lang.Object onObject,
java.lang.String identifier)
throws TemplateRuntimeException
- Throws:
TemplateRuntimeException
callMethod
protected java.lang.Object callMethod(BuildContext context,
java.lang.Object onObject,
java.lang.reflect.Method method)
throws TemplateRuntimeException
- Throws:
TemplateRuntimeException
getField
protected abstract java.lang.reflect.Field getField(java.lang.Class<?> clazz,
java.lang.String identifier)
throws TemplateRuntimeException
- Throws:
TemplateRuntimeException
findField
protected java.lang.reflect.Field findField(java.lang.Class<?> clazz,
java.lang.String identifier)
throws TemplateRuntimeException
- Throws:
TemplateRuntimeException
scanFields
protected java.lang.reflect.Field scanFields(java.lang.Class<?> clazz,
java.lang.String identifier)
throws TemplateRuntimeException
- Throws:
TemplateRuntimeException
getMethod
protected abstract java.lang.reflect.Method getMethod(java.lang.Class<?> clazz,
java.lang.String identifier,
int numberOfParameters)
throws TemplateRuntimeException
- Throws:
TemplateRuntimeException
Copyright © 2008. All Rights Reserved.