-
Notifications
You must be signed in to change notification settings - Fork 882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementing Consumer<Builder> fluent setters on model builders. #278
Conversation
return new StringBuilder() | ||
.append(StringUtils.isNotBlank(documentation) ? documentation : DEFAULT_SETTER.replace("%s", name) + "\n") | ||
.append(LF) | ||
.append("This is a convenience which creates an instance of the {@link ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just use string appending instead of the builder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could do - but this is how the other doc builders work...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
88e365b
to
0ef37a2
Compare
@@ -385,6 +385,30 @@ public String getFluentSetterDocumentation() { | |||
return docBuilder.toString(); | |||
} | |||
|
|||
public String getDefaultConsumerFluentSetterDocumentation() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we define this in Poet or here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like all the other documentation definitions are here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with this way, but I kinda like what Varun did in his pagination PR having a PaginationDocs.java file with the docs related to pagination
0ef37a2
to
0725586
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just the one minor comment on docs as far as the code goes.
If we have examples for this style, definitely need to figure out some formatting pattern for nested objects.
@@ -1064,6 +1065,21 @@ public String toString() { | |||
Builder structWithNestedTimestampMember(StructWithTimestamp structWithNestedTimestampMember); | |||
|
|||
/** | |||
* Sets the value of the StructWithNestedTimestampMember property for this object. | |||
* | |||
* This is a convenience which creates an instance of the {@link StructWithTimestamp.Builder} avoiding the need |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include something on how we will call build automatically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
.append(getEnumDoc()); | ||
return docBuilder.toString(); | ||
return getSetterDocumentation() | ||
+ LF |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does LF abbr stand for (saw the member declaration)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line-feed
0725586
to
f7f0a91
Compare
73351c3
to
710b3af
Compare
Description
Allows providing a
Consumer<Builder>
to complex fluent models setters to avoid having to create the appropriate builder yourself. As an example SES send message goes from:to a:
Motivation and Context
Allows customers who dislike the verbose
ComplexObject.builder().property("..").build()
pattern to create object hierarchies with a shorter syntax.Testing
New poet tests added.