org.jbehave.core.steps
Class CandidateStep

java.lang.Object
  extended by org.jbehave.core.steps.CandidateStep

public class CandidateStep
extends Object

Creates candidate step from a regex pattern of a step of a given type, associated to a Java method.

Author:
Elizabeth Keogh, Mauro Talevi, Paul Hammant

Nested Class Summary
static class CandidateStep.NoGroupFoundForName
           
static class CandidateStep.StartingWordNotFound
           
 
Field Summary
static String PARAMETER_NAME_END
           
static String PARAMETER_NAME_START
           
static String PARAMETER_VALUE_END
           
static String PARAMETER_VALUE_START
           
protected  ParameterConverters parameterConverters
           
protected  Object steps
           
 
Constructor Summary
CandidateStep(String patternAsString, int priority, StepType stepType, Method method, CandidateSteps steps, StepPatternBuilder patternBuilder, ParameterConverters parameterConverters, Map<StepType,String> startingWords)
           
CandidateStep(String patternAsString, int priority, StepType stepType, Method method, Object stepsInstance, StepPatternBuilder patternBuilder, ParameterConverters parameterConverters, Map<StepType,String> startingWords)
           
 
Method Summary
protected  String[] annotatedParameterNames()
          Extract annotated parameter names from the @Named parameter annotations
protected  Object[] argsForStep(Map<String,String> tableRow, Matcher matcher, Type[] types, String[] annotationNames, String[] parameterNames)
           
 Step createFrom(Map<String,String> tableRow, String stepAsString)
           
protected  Step createStep(String stepAsString, Map<String,String> tableRow, Matcher matcher, Method method, StepMonitor stepMonitor, String[] groupNames)
           
protected  String getGroup(Matcher matcher, String name)
           
protected  com.thoughtworks.paranamer.Paranamer getParanamer()
           
 Pattern getPattern()
           
 String getPatternAsString()
           
 Integer getPriority()
           
 StepType getStepType()
           
 boolean ignore(String stepAsString)
           
 boolean matches(String stepAsString)
           
 String toString()
           
protected  String translatedStep(String stepAsString, Map<String,String> tableRow, Type[] types, String[] annotationNames, String[] parameterNames)
           
 void useParanamer(com.thoughtworks.paranamer.Paranamer paranamer)
           
 void useStepMonitor(StepMonitor stepMonitor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PARAMETER_NAME_START

public static final String PARAMETER_NAME_START
See Also:
Constant Field Values

PARAMETER_NAME_END

public static final String PARAMETER_NAME_END
See Also:
Constant Field Values

PARAMETER_VALUE_START

public static final String PARAMETER_VALUE_START
See Also:
Constant Field Values

PARAMETER_VALUE_END

public static final String PARAMETER_VALUE_END
See Also:
Constant Field Values

steps

protected final Object steps

parameterConverters

protected final ParameterConverters parameterConverters
Constructor Detail

CandidateStep

public CandidateStep(String patternAsString,
                     int priority,
                     StepType stepType,
                     Method method,
                     CandidateSteps steps,
                     StepPatternBuilder patternBuilder,
                     ParameterConverters parameterConverters,
                     Map<StepType,String> startingWords)

CandidateStep

public CandidateStep(String patternAsString,
                     int priority,
                     StepType stepType,
                     Method method,
                     Object stepsInstance,
                     StepPatternBuilder patternBuilder,
                     ParameterConverters parameterConverters,
                     Map<StepType,String> startingWords)
Method Detail

useStepMonitor

public void useStepMonitor(StepMonitor stepMonitor)

useParanamer

public void useParanamer(com.thoughtworks.paranamer.Paranamer paranamer)

getParanamer

protected com.thoughtworks.paranamer.Paranamer getParanamer()

getPriority

public Integer getPriority()

ignore

public boolean ignore(String stepAsString)

matches

public boolean matches(String stepAsString)

createFrom

public Step createFrom(Map<String,String> tableRow,
                       String stepAsString)

argsForStep

protected Object[] argsForStep(Map<String,String> tableRow,
                               Matcher matcher,
                               Type[] types,
                               String[] annotationNames,
                               String[] parameterNames)

translatedStep

protected String translatedStep(String stepAsString,
                                Map<String,String> tableRow,
                                Type[] types,
                                String[] annotationNames,
                                String[] parameterNames)

getGroup

protected String getGroup(Matcher matcher,
                          String name)

annotatedParameterNames

protected String[] annotatedParameterNames()
Extract annotated parameter names from the @Named parameter annotations

Returns:
An array of annotated parameter names, which may include null values for parameters that are not annotated

createStep

protected Step createStep(String stepAsString,
                          Map<String,String> tableRow,
                          Matcher matcher,
                          Method method,
                          StepMonitor stepMonitor,
                          String[] groupNames)

getStepType

public StepType getStepType()

getPatternAsString

public String getPatternAsString()

getPattern

public Pattern getPattern()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2003-2010. All Rights Reserved.