io.quarkus.runtime.annotations.RegisterForReflection Java Examples

The following examples show how to use io.quarkus.runtime.annotations.RegisterForReflection. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RegisterForReflectionBuildStep.java    From quarkus with Apache License 2.0 5 votes vote down vote up
@BuildStep
public void build() {
    for (AnnotationInstance i : combinedIndexBuildItem.getIndex()
            .getAnnotations(DotName.createSimple(RegisterForReflection.class.getName()))) {

        boolean methods = getBooleanValue(i, "methods");
        boolean fields = getBooleanValue(i, "fields");
        boolean ignoreNested = getBooleanValue(i, "ignoreNested");

        AnnotationValue targetsValue = i.value("targets");
        AnnotationValue classNamesValue = i.value("classNames");

        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
        if (targetsValue == null && classNamesValue == null) {
            ClassInfo classInfo = i.target().asClass();
            registerClass(classLoader, classInfo.name().toString(), methods, fields, ignoreNested);
            continue;
        }

        if (targetsValue != null) {
            Type[] targets = targetsValue.asClassArray();
            for (Type type : targets) {
                registerClass(classLoader, type.name().toString(), methods, fields, ignoreNested);
            }
        }

        if (classNamesValue != null) {
            String[] classNames = classNamesValue.asStringArray();
            for (String className : classNames) {
                registerClass(classLoader, className, methods, fields, ignoreNested);
            }
        }
    }
}
 
Example #2
Source File: RegisterForReflectionAnnotator.java    From abstract-operator with Apache License 2.0 4 votes vote down vote up
@Override
public void propertyOrder(JDefinedClass clazz, JsonNode propertiesNode) {
    super.propertyOrder(clazz, propertiesNode);
    clazz.annotate(RegisterForReflection.class);
}