Search in sources :

Example 6 with ExtensibleType

use of org.glassfish.hk2.classmodel.reflect.ExtensibleType in project Payara by payara.

the class AnnotationInfo method init.

private void init(ExtensibleType<? extends ExtensibleType> type) {
    // recurse first so that re-stated annotations "override"
    ExtensibleType<? extends ExtensibleType> supertype = type.getParent();
    if (supertype != null) {
        init(supertype);
    }
    for (InterfaceModel implementedInterface : type.getInterfaces()) {
        if (implementedInterface != null && implementedInterface != type) {
            init(implementedInterface);
        }
    }
    // collect annotations
    putAll(type.getAnnotations(), typeAnnotations);
    if (type instanceof ClassModel) {
        for (FieldModel field : ((ClassModel) type).getFields()) {
            putAll(field.getAnnotations(), fieldAnnotations.computeIfAbsent(field.getName(), key -> new ConcurrentHashMap<>()));
        }
    }
    for (MethodModel method : type.getMethods()) {
        putAll(method.getAnnotations(), methodAnnotations.computeIfAbsent(getSignature(method), key -> new ConcurrentHashMap<>()));
        for (Parameter parameter : method.getParameters()) {
            putAll(parameter.getAnnotations(), methodParameterAnnotations.computeIfAbsent(getIdentifier(parameter), key -> new ConcurrentHashMap<>()));
        }
    }
}
Also used : InterfaceModel(org.glassfish.hk2.classmodel.reflect.InterfaceModel) Collection(java.util.Collection) MethodModel(org.glassfish.hk2.classmodel.reflect.MethodModel) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) AnnotatedElement(org.glassfish.hk2.classmodel.reflect.AnnotatedElement) FieldModel(org.glassfish.hk2.classmodel.reflect.FieldModel) Parameter(org.glassfish.hk2.classmodel.reflect.Parameter) Field(java.lang.reflect.Field) ExtensibleType(org.glassfish.hk2.classmodel.reflect.ExtensibleType) Map(java.util.Map) Annotation(java.lang.annotation.Annotation) Method(java.lang.reflect.Method) AnnotationModel(org.glassfish.hk2.classmodel.reflect.AnnotationModel) ClassModel(org.glassfish.hk2.classmodel.reflect.ClassModel) MethodModel(org.glassfish.hk2.classmodel.reflect.MethodModel) InterfaceModel(org.glassfish.hk2.classmodel.reflect.InterfaceModel) ClassModel(org.glassfish.hk2.classmodel.reflect.ClassModel) Parameter(org.glassfish.hk2.classmodel.reflect.Parameter) FieldModel(org.glassfish.hk2.classmodel.reflect.FieldModel) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Aggregations

AnnotationModel (org.glassfish.hk2.classmodel.reflect.AnnotationModel)4 SchemaImpl (fish.payara.microprofile.openapi.impl.model.media.SchemaImpl)3 Schema (org.eclipse.microprofile.openapi.models.media.Schema)3 ClassModel (org.glassfish.hk2.classmodel.reflect.ClassModel)3 ExtensibleType (org.glassfish.hk2.classmodel.reflect.ExtensibleType)3 FieldModel (org.glassfish.hk2.classmodel.reflect.FieldModel)3 MethodModel (org.glassfish.hk2.classmodel.reflect.MethodModel)3 Annotation (java.lang.annotation.Annotation)2 ArrayList (java.util.ArrayList)2 ParameterizedInterfaceModel (org.glassfish.hk2.classmodel.reflect.ParameterizedInterfaceModel)2 AnnotationInfo (fish.payara.microprofile.openapi.impl.visitor.AnnotationInfo)1 Field (java.lang.reflect.Field)1 Method (java.lang.reflect.Method)1 Collection (java.util.Collection)1 List (java.util.List)1 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 Components (org.eclipse.microprofile.openapi.models.Components)1 SchemaType (org.eclipse.microprofile.openapi.models.media.Schema.SchemaType)1 AnnotatedElement (org.glassfish.hk2.classmodel.reflect.AnnotatedElement)1