Skip to content

feat: add composable annotations support - #920

Open
bengbengbalabalabeng wants to merge 12 commits into
apache:mainfrom
bengbengbalabalabeng:feat-composable-annotations
Open

feat: add composable annotations support#920
bengbengbalabalabeng wants to merge 12 commits into
apache:mainfrom
bengbengbalabalabeng:feat-composable-annotations

Conversation

@bengbengbalabalabeng

@bengbengbalabalabeng bengbengbalabalabeng commented May 24, 2026

Copy link
Copy Markdown
Contributor

Purpose of the pull request

Related: #918

Added composable annotations support. For more usage examples, please refer to #918.

What's changed?

  1. Introduce two meta-annotations, @FesodMarked and @FesodMarked.AliasFor, to expand the Target - ElementType#ANNOTATION_TYPE restriction scope for other internal annotations except @ExcelIgnore and @ExcelIgnoreUnannotated, making it convenient for users to define custom combined annotations.
  2. Added enableMetaMarked to selectively enable composite annotation analysis. (Disabled by default)
  3. Defines AnnotatedElementDescriptor to encapsulate the class/field-level element types and (composable) annotations in ExcelHeadProperty.
  4. Define AnnotationMetadataReader to refactor the internal annotation parsing and storage approach.
  5. New AnnotatedClassUtils utility class (similar to ClassUtils) added to handle field parsing (read/write).
  6. Added unit tests and integration tests, covering scenarios such as field-level annotations, class-level annotations, and class + field - level annotations.

Unresolved: #919
My handling: Delete this part of the logic in AnnotatedClassUtils.

Checklist

  • I have read the Contributor Guide.
  • I have written the necessary doc or comment.
  • I have added the necessary unit tests and all cases have passed.

bengbengbalabalabeng and others added 8 commits May 17, 2026 23:06
Task-1: Collect all annotation (include composite) map when initializing the read/write head property.
Task-2:

-  Introduced `AnnotatedTypeDescriptor` and `AnnotatedFieldDescriptor` abstract models to carry metadata parsing logic at the class and field dimensions, respectively.
-  Encapsulated the `AnnotatedClassUtils`, rewriting part of the `ClassUtils` logic based on `AnnotatedElementDescriptor`.
-  Introduced the `enableMetaMarked` configuration flag to ensure read/write stability when handling legacy ClassUtils logic (such as `declaredExcelContentProperty` and `declaredFields`).
@bengbengbalabalabeng
bengbengbalabalabeng marked this pull request as ready for review July 27, 2026 10:54
# Conflicts:
#	fesod-sheet/src/test/java/org/apache/fesod/sheet/cache/CacheDataTest.java
#	fesod-sheet/src/test/java/org/apache/fesod/sheet/style/AnnotatedFieldDescriptorTest.java
#	fesod-sheet/src/test/java/org/apache/fesod/sheet/style/AnnotatedTypeDescriptorTest.java
#	fesod-sheet/src/test/java/org/apache/fesod/sheet/style/AnnotationAttributesTest.java
#	fesod-sheet/src/test/java/org/apache/fesod/sheet/style/AnnotationMapTest.java
#	fesod-sheet/src/test/java/org/apache/fesod/sheet/style/AnnotationMetadataReaderTest.java
#	fesod-sheet/src/test/java/org/apache/fesod/sheet/style/AnnotationMetadataResolverTest.java
#	fesod-sheet/src/test/java/org/apache/fesod/sheet/style/AnnotationMetadataTest.java
#	fesod-sheet/src/test/java/org/apache/fesod/sheet/style/composite/AnnotatedDescriptorAssertions.java
#	fesod-sheet/src/test/java/org/apache/fesod/sheet/style/composite/CompositeAnnotationTest.java
#	fesod-sheet/src/test/java/org/apache/fesod/sheet/style/composite/DirectAnnotationTest.java
#	fesod-sheet/src/test/java/org/apache/fesod/sheet/style/composite/IntegrationAnnotations.java
#	fesod-sheet/src/test/java/org/apache/fesod/sheet/style/composite/IntegrationCompositeAnnotationTest.java
#	fesod-sheet/src/test/java/org/apache/fesod/sheet/style/composite/IntegrationExcelDatas.java
#	fesod-sheet/src/test/java/org/apache/fesod/sheet/style/composite/WorkbookAsserts.java
@nkuprins

Copy link
Copy Markdown
Contributor

Hi @bengbengbalabalabeng. I noticed that this cool PR introduces AnnotatedClassUtils. Have you read #989 by any chance? It seems that the issue raised there is also related to AnnotatedClassUtils. I would appreciate hearing your opinion on this :)
I ask this because if this gets merged and later ClassUtils refactoring gets approved, then we may have two @Deprecated problems at once.

Besides, in AnnotatedClassUtils#doDeclaredFields (line 317) there's indexFieldMap.remove(index). That's the bug #977 fixed in ClassUtils, where it's now indexFieldMap.remove(key). Not sure if you already noticed that.

@bengbengbalabalabeng

Copy link
Copy Markdown
Contributor Author

I noticed that this cool PR introduces AnnotatedClassUtils. Have you read #989 by any chance? It seems that the issue raised there is also related to AnnotatedClassUtils. I would appreciate hearing your opinion on this :)
I ask this because if this gets merged and later ClassUtils refactoring gets approved, then we may have two @Deprecated problems at once.

As for the design direction mentioned in #989, I don't have any concrete ideas yet, I'll add a follow-up comment once I have a clearer picture.

As for the current PR, there's no need to worry for now. I may continue to break it down into smaller, more detailed drafts to track progress.

Besides, in AnnotatedClassUtils#doDeclaredFields (line 317) there's indexFieldMap.remove(index). That's the bug #977 fixed in ClassUtils, where it's now indexFieldMap.remove(key). Not sure if you already noticed that.

Thank you for the reminder :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants