- Revision
- 1495
- Author
- mauro
- Date
- 2010-01-05 06:42:33 -0600 (Tue, 05 Jan 2010)
Log Message
Extracted method annotationName(Annotation)
Modified Paths
Diff
Modified: trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/steps/CandidateStep.java (1494 => 1495)
--- trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/steps/CandidateStep.java 2010-01-05 12:12:56 UTC (rev 1494) +++ trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/steps/CandidateStep.java 2010-01-05 12:42:33 UTC (rev 1495) @@ -217,16 +217,22 @@ for (int x = 0; x < parameterAnnotations.length; x++) { Annotation[] annotations = parameterAnnotations[x]; for (Annotation annotation : annotations) { - if (annotation.annotationType().isAssignableFrom(Named.class)) { - names[x] = ((Named) annotation).value(); - } else if ("javax.inject.Named".equals(annotation.annotationType().getName())) { - names[x] = Jsr330Helper.getNamedValue(annotation); - } + names[x] = annotationName(annotation); } } return names; } + private String annotationName(Annotation annotation) { + if (annotation.annotationType().isAssignableFrom(Named.class)) { + return ((Named) annotation).value(); + } else if ("javax.inject.Named".equals(annotation.annotationType().getName())) { + return Jsr330Helper.getNamedValue(annotation); + } else { + return null; + } + } + private String findStartingWord(final String stepAsString) throws StartingWordNotFound { String wordForType = startingWordFor(stepType); if (stepAsString.startsWith(wordForType)) { @@ -322,13 +328,14 @@ } } - + /** * This is a different class, because the @Inject jar may not be in the classpath. */ - public static class Jsr330Helper { - private static String getNamedValue(Annotation ann) { - return ((javax.inject.Named) ann).value(); + private static class Jsr330Helper { + + private static String getNamedValue(Annotation annotation) { + return ((javax.inject.Named) annotation).value(); } }
To unsubscribe from this list please visit:
