Skip to content

[Tech] Introduce the ResourceFactory utility; streamline virtual resource creating logic#648

Open
smiakchilo wants to merge 14 commits intodevelopfrom
tech/resource-factory
Open

[Tech] Introduce the ResourceFactory utility; streamline virtual resource creating logic#648
smiakchilo wants to merge 14 commits intodevelopfrom
tech/resource-factory

Conversation

@smiakchilo
Copy link
Copy Markdown
Collaborator

No description provided.

@smiakchilo smiakchilo added maintenance Code cleanup, reordering or minor refactoring AEM AEM-specific competencies are involved labels Apr 8, 2026
@smiakchilo smiakchilo requested a review from Copilot April 8, 2026 21:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new internal ResourceFactory utility to streamline creation of virtual Sling Resource instances (primarily ValueMapResource) and refactors multiple option/list-related components and tests to use it instead of ad-hoc ValueMapResource / ValueMapDecorator builders.

Changes:

  • Added ResourceFactory with fluent builders (including nested-property-to-child-resource expansion and Granite field helpers) plus a dedicated test suite.
  • Replaced several direct ValueMapResource constructions in option source resolvers, list utilities, and servlets with ResourceFactory.
  • Removed the old ValueMapBuilder helper and renamed ListResourceUtil.mapToValueMapResources() to mapToResources().

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
core/src/main/java/com/exadel/aem/toolkit/core/utils/ResourceFactory.java New fluent builder for virtual resources/fields; replaces scattered ValueMapResource usage.
core/src/test/java/com/exadel/aem/toolkit/core/utils/ResourceFactoryTest.java New tests covering path normalization, children, nested properties, and multifield wrapper behavior.
core/src/main/java/com/exadel/aem/toolkit/core/lists/utils/ListResourceUtil.java Replaces ValueMapResource creation helpers with ResourceFactory; renames map conversion method.
core/src/test/java/com/exadel/aem/toolkit/core/lists/utils/ListResourceUtilTest.java Updates test to call mapToResources().
core/src/main/java/com/exadel/aem/toolkit/core/lists/utils/ListHelper.java Switches list-item virtual resource creation to ResourceFactory.
core/src/main/java/com/exadel/aem/toolkit/core/lists/servlets/ItemComponentsServlet.java Uses ResourceFactory to build datasource option resources.
core/src/main/java/com/exadel/aem/toolkit/core/optionprovider/services/impl/resolvers/InlineOptionSourceResolver.java Uses ResourceFactory and Map-based properties instead of ValueMapBuilder/ValueMapResource.
core/src/main/java/com/exadel/aem/toolkit/core/optionprovider/services/impl/resolvers/HttpOptionSourceResolver.java Uses ResourceFactory; changes createValueMap to return Map<String,Object>.
core/src/main/java/com/exadel/aem/toolkit/core/optionprovider/services/impl/resolvers/EnumResolverHelper.java Uses ResourceFactory and plain Maps for option resources.
core/src/main/java/com/exadel/aem/toolkit/core/optionprovider/services/impl/resolvers/ConstantsResolverHelper.java Uses ResourceFactory and Map-based reduction logic; removes ValueMapBuilder usage.
core/src/main/java/com/exadel/aem/toolkit/core/optionprovider/services/impl/resolvers/ValueMapBuilder.java Removed (superseded by Map + ResourceFactory).
core/src/test/java/com/exadel/aem/toolkit/core/configurator/models/internal/RenderConditionTest.java Refactors test resource creation to use ResourceFactory.
core/src/test/java/com/exadel/aem/toolkit/AllTests.java Adds ResourceFactoryTest to the aggregated test suite.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread core/src/main/java/com/exadel/aem/toolkit/core/utils/ResourceFactory.java Outdated
@smiakchilo smiakchilo force-pushed the tech/resource-factory branch from 0573997 to 1bd3a50 Compare April 9, 2026 15:25
@smiakchilo smiakchilo changed the title [Tech] Introduce the ResourceFactory utility; strealine virtual resource creating logic [Tech] Introduce the ResourceFactory utility; streamline virtual resource creating logic Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AEM AEM-specific competencies are involved maintenance Code cleanup, reordering or minor refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants