Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/choonchernlim/spring-modularizer
Transforms an input object into a modularized result object based on the requested data module(s).
https://github.com/choonchernlim/spring-modularizer
data-structures design-patterns groovy java-8 spring
Last synced: about 1 month ago
JSON representation
Transforms an input object into a modularized result object based on the requested data module(s).
- Host: GitHub
- URL: https://github.com/choonchernlim/spring-modularizer
- Owner: choonchernlim
- License: mit
- Created: 2019-01-18T19:26:36.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-22T21:31:09.000Z (about 6 years ago)
- Last Synced: 2024-11-06T00:40:58.090Z (3 months ago)
- Topics: data-structures, design-patterns, groovy, java-8, spring
- Language: Groovy
- Homepage:
- Size: 23.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# spring-modularizer [![Build Status](https://travis-ci.org/choonchernlim/spring-modularizer.svg?branch=master)](https://travis-ci.org/choonchernlim/spring-modularizer) [![codecov](https://codecov.io/gh/choonchernlim/spring-modularizer/branch/master/graph/badge.svg)](https://codecov.io/gh/choonchernlim/spring-modularizer)
Transforms an input object into a modularized result object based on the requested data module(s).
## Maven Dependency
```xml
com.github.choonchernlim
spring-modularizer
0.1.0```
## Motivation
To provide an ability to enrich the result object by adding more data modules over time without introducing too many cross cutting concerns.
```text
---------------------------------------------------------------------------------------------------------
INPUT DATA TRANSFORMATION RESULT
---------------------------------------------------------------------------------------------------------
ORM entity, ID, etc. Either cherry-picking from Result object that can be sent back to the
input object or query against user either as object, JSON or XML.
data source(s) to construct The fingerprints allow the user to quickly
requested module(s). determine whether the values have changed
or not.
{
"id": "",
"fingerprint": ""
"a": {
"fingerprint": "",
✓ [ Mapper A ] "prop-1": ...
[ Mapper B ] "prop-2": ...
Input Object ---> ✓ [ Mapper C ] ---> },
[ Mapper D ] "b": null,
[ Mapper ... ] "c": {
[ Mapper Z ] "fingerprint": "",
"prop-3": ...
"prop-4": ...
},
"d": null,
...
}
```At high level, the code looks something like this:-
```groovy
Set selectedModules = [ SomeModule.A, SomeModule.C ]SomeEntity entity = // query from DB, etc
// autowired `modularizerService`
SomeResult result = modularizerService.create(entity, selectedModules, SomeResult)
```
## Real World ExampleRun `Main.groovy` under ["example" package](src/test/groovy/example) and play around with it.