Comments (6)
๐ค facundo.m.viale ย ๐ Aug 04, 2009 at 12:08 UTC
It would be useful for make chained invocation if the setters generated by
Lambok return the instance of the object.
Ej.
class Factory {
Factory setSomething(Something something) { ... return this; }
Factory setOther(Other other) { ... return this; }
Thing result() { ... }
}
Thing thing = new Factory()
.setSomething(something)
.setOther(other)
.result();
from lombok.
๐ค reinierz ย ๐ Aug 05, 2009 at 14:14 UTC
That would be the builder pattern. As unfortunate as it is, the understanding of a 'setter' in the greater java
community is a method that returns void.
We will add the Builder pattern at some point, though. That will help with chaining needs.
Adding a 'returnThis=true' kind of parameter to @ Setter also seems a bit unfortunate, as we'd have to
duplicate it to @ Data lest people are forced to add a tonne of @ Setter annotations. And yet, that feels like a
path that leads to 50 options on @ Data which is something we're trying to avoid - Hence, builder pattern.
I did make an issue for adding a Builder for you, though :)
from lombok.
๐ค reinierz ย ๐ Aug 05, 2009 at 14:14 UTC
Duplicate of issue #89
from lombok.
๐ค reinierz ย ๐ Oct 16, 2009 at 08:48 UTC
from lombok.
๐ค reinierz ย ๐ May 09, 2011 at 20:58 UTC
Issue #270 has been merged into this issue.
from lombok.
End of migration
from lombok.
Related Issues (20)
- How Lombok solves the error of๏ผ cannot access class com.sun.tools.javac.๏ผ? HOT 3
- [BUG] @Nullable on field with lazy getter incorrectly applied to field HOT 2
- [BUG] HOT 1
- [FEATURE] JDK 23 compatibility HOT 1
- [BUG] HOT 2
- [BUG] Jacksonized generates inconsistent annotations in byte code based on imports and builderClassName HOT 1
- [BUG] Test step test-eclipse (eclipse-I-build-full) broken
- [BUG] ASTParsing error with latest eclipse jdt version when javadoc is present HOT 1
- [FEATURE] @Accessors(chain = true) can not generate accessor for parent
- [FEATURE] covariant override of chained setters in subclass
- [BUG] 1.18.34 regression: /* */ comments above javadoc causes "HandleConstructor$HandleAllArgsConstructor failed" HOT 2
- [FEATURE] "lombok.addNullAnnotations" support for jspecify
- [BUG] lombok-mapstruct-binding incorrectly removes the "is" prefix
- [FEATURE] "inline" Builder methods that create a field from its constructor arguments
- [BUG] loader constraint violation: when resolving method
- [BUG] `@Slf4j` causes error with variable named `org` but not with `org1`
- [FEATURE] Add @ToJson and @FromJson Annotations for Automatic JSON Serialization and Deserialization HOT 1
- [FEATURE] let, also, run similar to Kotlin's Any objects
- [FEATURE] Default value return in case of exception
- [BUG] Missed null checks in record constructor when non-Lombok annotations are used HOT 1
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 lombok.