use of eu.infomas.annotation.AnnotationDetector in project bladecoder-adventure-engine by bladecoder.
the class ActionDetector method detect.
public static void detect() {
actions = new HashMap<String, Class<?>>();
final TypeReporter reporter = new TypeReporter() {
@SuppressWarnings("unchecked")
@Override
public Class<? extends Annotation>[] annotations() {
return new Class[] { ActionDescription.class };
}
@SuppressWarnings("unchecked")
@Override
public void reportTypeAnnotation(Class<? extends Annotation> annotation, String className) {
Class<Action> c = null;
try {
c = ClassReflection.forName(className);
} catch (ReflectionException e) {
EditorLogger.printStackTrace(e);
}
String name = ActionUtils.getName(c);
if (!c.isAssignableFrom(EndAction.class) && !c.isAssignableFrom(DisableActionAction.class))
actions.put(name, c);
}
};
final AnnotationDetector cf = new AnnotationDetector(reporter);
try {
cf.detect();
} catch (IOException e) {
EditorLogger.printStackTrace(e);
}
}
Aggregations