From c7a02a1638b93dec12df8010389b9304f0a06278 Mon Sep 17 00:00:00 2001 From: Siphalor Date: Mon, 3 Nov 2025 23:51:07 +0100 Subject: [PATCH] feat(annotation-inheritance): Add toString to custom annotated element --- .../api/AnnotationInheritanceAwareAnnotatedElement.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tweed5/annotation-inheritance/src/main/java/de/siphalor/tweed5/annotationinheritance/api/AnnotationInheritanceAwareAnnotatedElement.java b/tweed5/annotation-inheritance/src/main/java/de/siphalor/tweed5/annotationinheritance/api/AnnotationInheritanceAwareAnnotatedElement.java index 86ff447..0d349f5 100644 --- a/tweed5/annotation-inheritance/src/main/java/de/siphalor/tweed5/annotationinheritance/api/AnnotationInheritanceAwareAnnotatedElement.java +++ b/tweed5/annotation-inheritance/src/main/java/de/siphalor/tweed5/annotationinheritance/api/AnnotationInheritanceAwareAnnotatedElement.java @@ -82,6 +82,15 @@ public class AnnotationInheritanceAwareAnnotatedElement implements AnnotatedElem 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 getOrResolveAnnotations() { if (resolvedAnnotations == null) { resolvedAnnotations = new AnnotationInheritanceResolver(inner).resolve();