use of jodd.util.AnnotationParser in project jodd by oblac.
the class ActionConfigManager method bindAnnotationConfig.
/**
* Binds action annotation and the action config. This can overwrite the default annotation
* configuration of an annotation.
*/
public void bindAnnotationConfig(final Class<? extends Annotation> annotationType, final Class<? extends ActionConfig> actionConfigClass) {
final ActionConfig actionConfig = registerNewActionConfiguration(actionConfigClass);
actionConfigs.put(annotationType, actionConfig);
for (final AnnotationParser annotationParser : annotationParsers) {
if (annotationType.equals(annotationParser.getAnnotationType())) {
// parser already exists
return;
}
}
annotationParsers = ArraysUtil.append(annotationParsers, new AnnotationParser(annotationType, Action.class));
}
use of jodd.util.AnnotationParser in project jodd by oblac.
the class ActionAnnotationTest method testMiscActionAnnotation.
@Test
void testMiscActionAnnotation() throws NoSuchMethodException {
final AnnotationParser annotationParser = parserFor(MiscAnnotation.class);
Method method = this.getClass().getMethod("hello5");
ActionAnnotationValues annotationValues = ActionAnnotationValues.of(annotationParser, method);
assertNull(annotationValues.alias());
assertEquals("VAL", annotationValues.value());
method = this.getClass().getMethod("hello6");
annotationValues = ActionAnnotationValues.of(annotationParser, method);
assertNull(annotationValues.alias());
assertEquals("VAL", annotationValues.value());
}
use of jodd.util.AnnotationParser in project jodd by oblac.
the class ActionAnnotationTest method testCustomActionAnnotation.
@Test
void testCustomActionAnnotation() throws NoSuchMethodException {
final AnnotationParser annotationParser = parserFor(CustomAction.class);
Method method = this.getClass().getMethod("hello3");
ActionAnnotationValues annotationValues = ActionAnnotationValues.of(annotationParser, method);
assertEquals("ALIAS", annotationValues.alias());
assertNull(annotationValues.value());
method = this.getClass().getMethod("hello4");
annotationValues = ActionAnnotationValues.of(annotationParser, method);
assertEquals("ALIAS", annotationValues.alias());
assertNull(annotationValues.value());
}
Aggregations