Skip to content

Commit

Permalink
add javadoc to builder factory method
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmoten committed Mar 6, 2020
1 parent c2fda70 commit 44f9dfa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,14 @@ private void writeBuilder(Structure<?> t, String simpleClassName, Imports import
}
String builderSuffix = t.getBaseType() == null ? "" : simpleClassName;

p.format("\n%s/**", indent);
p.format("\n%s * Returns a builder which is used to create a new", indent);
p.format("\n%s * instance of this class (given that this class is immutable).", indent);
p.format("\n%s *", indent);
p.format("\n%s * @return a new Builder for this class", indent);
p.format("\n%s */", indent);
p.format("\n%s// Suffix used on builder factory method to differentiate the method", indent);
p.format("\n%s// from static builder methods on superclasses", indent);
p.format("\n%spublic static Builder builder%s() {\n", indent, builderSuffix);
p.format("%sreturn new Builder();\n", indent.right());
p.format("%s}\n", indent.left());
Expand Down
8 changes: 8 additions & 0 deletions src/docs/FileAttachment.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ protected FileAttachment() {
super();
}

/**
* Returns a builder which is used to create a new
* instance of this class (given that this class is immutable).
*
* @return a new Builder for this class
*/
// Suffix used on builder factory method to differentiate the method
// from static builder methods on superclasses
public static Builder builderFileAttachment() {
return new Builder();
}
Expand Down

0 comments on commit 44f9dfa

Please sign in to comment.