feat(annotation-inheritance): Add toString to custom annotated element

This commit is contained in:
2025-11-03 23:51:07 +01:00
parent 837f614399
commit c7a02a1638

View File

@@ -82,6 +82,15 @@ public class AnnotationInheritanceAwareAnnotatedElement implements AnnotatedElem
return inner.getDeclaredAnnotations(); return inner.getDeclaredAnnotations();
} }
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName()).append('[');
getOrResolveAnnotations().forEach(annotation ->
sb.append(annotation).append(';')
);
return sb.append(']').toString();
}
private ClassToInstanceMap<Annotation> getOrResolveAnnotations() { private ClassToInstanceMap<Annotation> getOrResolveAnnotations() {
if (resolvedAnnotations == null) { if (resolvedAnnotations == null) {
resolvedAnnotations = new AnnotationInheritanceResolver(inner).resolve(); resolvedAnnotations = new AnnotationInheritanceResolver(inner).resolve();