Skip to content

refactor: split ClassUtils into metadata resolvers - #1099

Open
nkuprins wants to merge 16 commits into
apache:mainfrom
nkuprins:refactor/extract-classutils
Open

refactor: split ClassUtils into metadata resolvers#1099
nkuprins wants to merge 16 commits into
apache:mainfrom
nkuprins:refactor/extract-classutils

Conversation

@nkuprins

@nkuprins nkuprins commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Closed: #989

Purpose of the pull request

As title

What's changed?

  • Extracted column-layout resolution (declaredFields and its helpers) into a package-private SheetHeadFieldResolver.
  • Extracted per-field formatting resolution (declaredExcelContentProperty and its helpers) into a package-private SheetContentPropertyResolver.
  • Replaced the three switches with a MetadataCacheStrategy per CacheLocationEnum constant (InMemoryCache, ThreadLocalCache, NoOpCache), each owning its own storage. MetadataCaches composes the three for one kind of metadata and picks the tier from the ConfigurationHolder, so CacheLocationEnum is now referenced in one class instead of three switches. InMemoryCache and ThreadLocalCache also accept a map or map factory, to allow map types other than the defaults later.
  • ClassUtils keeps getAllInterfaces, both key classes, and every public entry point, delegating to the resolvers.
  • Deprecated FIELD_CACHE, CLASS_CONTENT_CACHE and CONTENT_CACHE in favour of getFieldCache() / getClassContentCache() / getContentCache() (unmodifiable, live views; the cached values are shared and must not be modified) and a new removeInMemoryCache(). The fields still alias the same live, mutable maps, so downstream reads and writes behave exactly as today - only a deprecation warning is added.
  • Tests: CacheDataTest no longer reads a private ThreadLocal field of ClassUtils and checks that the thread-local cache is cleared after a read through ClassUtils itself; ClassUtilsTest covers the three views; new MetadataCacheStrategyTest checks that ThreadLocalCache.clear() detaches the map from the thread.

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.

@nkuprins nkuprins changed the title refactor: split ClassUtils into cache resolvers refactor: split ClassUtils into metadata resolvers Sep 13, 2026
@nkuprins
nkuprins marked this pull request as ready for review September 13, 2026 19:08
@nkuprins

Copy link
Copy Markdown
Contributor Author

@bengbengbalabalabeng PTAL, when it's convenient for you 🙏🏻

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.

[Enhancement] Split ClassUtils into per-concern classes and de-duplicate the cache-location switch

1 participant