Comments (9)
Thank for your idea.
Can you give me a short example of what you want to do?
Just to get the use-case right.
My first guess would be, that the complexity for this feature might be high because if you want to chain setters, you have to have a valid instance of the source object available to invoke the setter on. The source object is generated later than the field-by-field mappings and currently there is no order defined on mappings.
from remap.
By chained setters I mean setter that return this
like:
class B {
int i;
B setI(int i) {
this.i = i;
return this;
}
}
So my proposal is to relax the pure java beans requirement for setters (either globally or it could be a mapper configuration).
from remap.
Ah okay, so if your idea is to relax the validation of set-methods to support chained setters I would welcome a PR :)
Sounds very reasonable to support this.
from remap.
I did a bit of research and debugging and I don't think there is a simple way to achieve this, since the bean introspection does not allow for chained/fluent setters.
It used to back in java 1.6.
So to implement this, we will either have to use a different introspection engine (extra external dependency), commons-beantutils seems to have one or write our own.
I will dig a bit deeper into this. One option could also be to generate two artifacts remap & remap-fluent where the -fluent has the extra dependency. But that would be at the cost of extra complexity in both code and build setup.
from remap.
I have made a proof of concept commit here: djarnis73@bcd99c8 please have a look and let me know if you like it.
from remap.
Hi, very cool that you managed to do it!
That does not look that complicated. Good idea!
I would like to integrate your PR. I would check backwards compatibility with our code base an then we go for a release :)
from remap.
Ah! One more thing. ReMap has an API for testing. Can you verify with a test, that the Assert API works well with your extension?
from remap.
How time flies, looks like I got distracted and never followed up on this. Are you still interested in getting this in? Then I will brush if off and submit a PR.
from remap.
Hey it's been a while :) I think it's a nice idea to support fluent setters. As you mentioned above, keep in mind, that you need another bean introspection service. Feel free to build a PR. Then we can figure out how to integrate this into remap :)
from remap.
Related Issues (20)
- Property path needs update to 0.1.0 HOT 1
- Property path support for set would be helpful
- Improve exception messages HOT 5
- Mapping is not applied for Set properties HOT 5
- Exception when creating mapper for generic type HOT 4
- Support for hierarchy HOT 3
- Map-Optional is missing for collections HOT 1
- Hamcrest not in test scope HOT 1
- Is it possible to update an existing object instead of creating a new one? HOT 4
- Android Support HOT 10
- custom mapping HOT 1
- Support mapping contributors? HOT 1
- An illegal reflective access operation has occurred HOT 4
- Mapping collection with specific implementation HOT 6
- A read-only property causes misleading exception when omitted as destination property
- Reassign property of Type Map fails with an EmptyStack exception HOT 4
- Java 17 compatibility HOT 1
- Feature: Default setting for mapping of null values wanted
- Upgrade to Property-Path version 0.2.0.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from remap.