/** * Return multiple annotations from field or accessor method. * * @param <A> the type parameter * @param entityClass the entity class * @param annotationClass given annotation type * @param identifier the identifier * @return annotation found or null if none found */ public <A extends Annotation> A[] getAttributeOrRelationAnnotations(Class<?> entityClass, Class<A> annotationClass, String identifier) { AccessibleObject fieldOrMethod = getEntityBinding(entityClass).fieldsToValues.get(identifier); if (fieldOrMethod == null) { return null; } return fieldOrMethod.getAnnotationsByType(annotationClass); }
/** * Return multiple annotations from field or accessor method. * * @param <A> the type parameter * @param entityClass the entity class * @param annotationClass given annotation type * @param identifier the identifier * @return annotation found or null if none found */ public <A extends Annotation> A[] getAttributeOrRelationAnnotations(Class<?> entityClass, Class<A> annotationClass, String identifier) { AccessibleObject fieldOrMethod = getEntityBinding(entityClass).fieldsToValues.get(identifier); if (fieldOrMethod == null) { return null; } return fieldOrMethod.getAnnotationsByType(annotationClass); }
try { return pathAnnotations.stream() .flatMap(a -> stream(executable.getAnnotationsByType(a))) .map(this::asPathAnnotation) .filter(Objects::nonNull)
protected void processBindingAnnotations(AccessibleObject object, Reference reference, Class<?> implClass, IntrospectionContext context) { A annotations[] = object.getAnnotationsByType(annotationType); if (annotations.length == 0) { // check meta-annotations for (Annotation annotation : object.getAnnotations()) { annotations = annotation.annotationType().getAnnotationsByType(annotationType); if (annotations.length > 0) { break; } } if (annotations.length == 0) { return; } } for (A annotation : annotations) { Binding binding = processReference(annotation, reference, implClass, context); if (binding == null) { continue; } reference.addBinding(binding); ServiceContract contract = reference.getServiceContract(); if (contract.getCallbackContract() != null) { Binding callbackBinding = processReferenceCallback(annotationType.cast(annotation), reference, implClass, context); if (callbackBinding != null) { reference.addCallbackBinding(callbackBinding); } } } }