|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.specrunner.parameters.core.ParameterHolder
org.specrunner.plugins.core.AbstractPlugin
org.specrunner.plugins.core.language.PluginSentence
public class PluginSentence
A natural language plugin to perform pattern matching like
JBehave/Cucumber/Twist fixtures.
Method match by default is performed from Java to arguments, the other
direction is possible using after=true.
| Field Summary | |
|---|---|
protected static ICache<Class<?>,List<Method>> |
cacheMethods
Cache of type to methods annotated with sentence. |
protected static ICache<String,Pattern> |
cachePatterns
Cache of patterns. |
| Fields inherited from class org.specrunner.plugins.core.AbstractPlugin |
|---|
FEATURE_CONDITION, FEATURE_NORMALIZED, FEATURE_SLEEP, FEATURE_THREADSAFE, FEATURE_TIMEOUT, FEATURE_WAIT |
| Constructor Summary | |
|---|---|
PluginSentence()
|
|
| Method Summary | |
|---|---|
void |
doEnd(IContext context,
IResultSet result)
The end action. i.e. after a loop specification perform something in a newly generated table. |
protected void |
extractMethodNameArguments(IContext context,
Object target,
StringBuilder methodName,
List<Object> arguments)
Extract text and arguments. |
protected boolean |
fromAnnotations(String value,
Object target,
StringBuilder text,
List<Object> args)
Perform method search from annotations. |
ActionType |
getActionType()
Get the plugin type. |
Boolean |
getAfter()
The flag status. |
String |
getMethod()
Get method name. |
protected Method |
getMethodAfter(Object target,
String method,
List<Object> args)
Get object method. |
protected Method |
getMethodBefore(Object target,
String method,
List<Object> args)
Get object method. |
protected Object |
getObject(IContext context)
Get the object instance to be used by plugin actions. |
protected void |
onlyArgs(IContext context,
nu.xom.Node node,
StringBuilder text,
List<Object> args)
Extract arguments from nodes. |
protected void |
onlyText(String text,
StringBuilder methodName,
List<Object> arguments)
Extract parameters from text. |
protected void |
prepareArgumentsAfter(IContext context,
Method method,
List<Object> arguments)
Prepare argument list, based on parameter types. |
protected void |
prepareArgumentsBefore(IContext context,
Method method,
List<Object> arguments)
Prepare argument list, based on parameter types. |
protected String |
removePlaceholders(Method method,
String str)
Remove place holders registered in Placeholders. i.e. |
void |
setAfter(Boolean after)
The flag to perform method lookup after arguments conversion. |
void |
setMethod(String method)
The method to call to this sentence. |
| Methods inherited from class org.specrunner.plugins.core.AbstractPlugin |
|---|
copy, doStart, getCondition, getConditionModel, getNormalized, getNormalized, getParent, getSleep, getSleepModel, getThreadsafe, getTimeout, getTimeoutModel, getWait, getWaitModel, initialize, setCondition, setConditionModel, setNormalized, setParent, setSleep, setSleepModel, setThreadsafe, setTimeout, setTimeoutModel, setWait, setWaitModel, toString |
| Methods inherited from class org.specrunner.parameters.core.ParameterHolder |
|---|
getParameters, setParameters |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.specrunner.parameters.IParameterHolder |
|---|
getParameters, setParameters |
| Field Detail |
|---|
protected static ICache<Class<?>,List<Method>> cacheMethods
protected static ICache<String,Pattern> cachePatterns
| Constructor Detail |
|---|
public PluginSentence()
| Method Detail |
|---|
public ActionType getActionType()
IActionType
public String getMethod()
public void setMethod(String method)
method - The method name.public Boolean getAfter()
public void setAfter(Boolean after)
after - true, to lookup method after arguments conversion, false,
otherwise.
public void doEnd(IContext context,
IResultSet result)
throws PluginException
IPlugin
doEnd in interface IPlugindoEnd in class AbstractPlugincontext - The context.result - The result set.
PluginException - On execution errors.protected Object getObject(IContext context)
context - The context.
protected void extractMethodNameArguments(IContext context,
Object target,
StringBuilder methodName,
List<Object> arguments)
throws PluginException
context - The context.target - The target object.methodName - The text part.arguments - The argument objects.
PluginException - On errors.
protected boolean fromAnnotations(String value,
Object target,
StringBuilder text,
List<Object> args)
throws PluginException
value - The node text value.target - The target object.text - The text.args - The arguments.
PluginException - On invalid placeholder replacement.
protected String removePlaceholders(Method method,
String str)
throws PluginException
Placeholders. i.e. $int
will be replaced to '(\\d+)'.
method - The method.str - The string to be replaced.
PluginException - On invalid placeholder replacement.
protected void onlyText(String text,
StringBuilder methodName,
List<Object> arguments)
text - The text.methodName - The method name.arguments - The arguments.
protected void onlyArgs(IContext context,
nu.xom.Node node,
StringBuilder text,
List<Object> args)
throws PluginException
context - The context.node - The node.text - The text.args - The arguments.
PluginException - On errors.
protected Method getMethodBefore(Object target,
String method,
List<Object> args)
throws PluginException
target - The object target.method - The method name.args - Possible arguments.
PluginException - On method lookup errors.
protected void prepareArgumentsBefore(IContext context,
Method method,
List<Object> arguments)
throws PluginException
context - The context.method - The method.arguments - The arguments.
PluginException - On preparation errors.
protected Method getMethodAfter(Object target,
String method,
List<Object> args)
throws PluginException
target - The object target.method - The method name.args - Possible arguments.
PluginException - On method lookup errors.
protected void prepareArgumentsAfter(IContext context,
Method method,
List<Object> arguments)
throws PluginException
context - The context.method - The method.arguments - The arguments.
PluginException - On preparation errors.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||