| 1 | |
package org.jbehave.core.steps.pico; |
| 2 | |
|
| 3 | |
import java.util.ArrayList; |
| 4 | |
import java.util.List; |
| 5 | |
|
| 6 | |
import org.jbehave.core.configuration.Configuration; |
| 7 | |
import org.jbehave.core.steps.AbstractStepsFactory; |
| 8 | |
import org.jbehave.core.steps.InjectableStepsFactory; |
| 9 | |
import org.picocontainer.ComponentAdapter; |
| 10 | |
import org.picocontainer.PicoContainer; |
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
|
| 19 | |
|
| 20 | |
public class PicoStepsFactory extends AbstractStepsFactory { |
| 21 | |
|
| 22 | |
private final PicoContainer parent; |
| 23 | |
|
| 24 | |
public PicoStepsFactory(Configuration configuration, PicoContainer parent) { |
| 25 | 6 | super(configuration); |
| 26 | 6 | this.parent = parent; |
| 27 | 6 | } |
| 28 | |
|
| 29 | |
@Override |
| 30 | |
protected List<Object> stepsInstances() { |
| 31 | 6 | List<Object> steps = new ArrayList<Object>(); |
| 32 | 6 | for (ComponentAdapter<?> adapter : parent.getComponentAdapters()) { |
| 33 | 25 | if (hasAnnotatedMethods(adapter.getComponentImplementation())) { |
| 34 | 5 | steps.add(parent.getComponent(adapter |
| 35 | |
.getComponentKey())); |
| 36 | |
} |
| 37 | |
} |
| 38 | 5 | return steps; |
| 39 | |
} |
| 40 | |
} |