-
Notifications
You must be signed in to change notification settings - Fork 91
Open
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationfeature requestNew feature or requestNew feature or request
Milestone
Description
Currently, the majority of our https://immutables.github.io/ builders don't have any javadoc; we (mostly) document the getter properties of the objects to be constructed.
As a simplified / abbreviated example:
/**
* The server configuration.
*/
public interface ServerConfig {
/**
* The network interface this server binds to as an IP address or a hostname. If not set, then bind to all
* interfaces.
*/
Optional<String> host();
/**
* The port.
*/
int port();
...
/**
* How many do we wait to shut down the server. Defaults to 10 seconds.
*/
@Default
default Duration shutdownTimeout() {
return Duration.ofMillis(DEFAULT_SHUTDOWN_TIMEOUT_MILLIS);
}
...
interface Builder {
Builder host(String host);
Builder port(int port);
...
Builder shutdownTimeout(Duration shutdownTimeout);
ServerConfig build();
}From the javadoc on the object's class, users might be able to infer the meaning and optionality of Builder#host, Builder#port, and Builder#shutdownTimeout.
Some options:
- Have equivalent (duplicated) javadoc on on the the objects and builder methods
- Document object methods, add
{@link ...}from builder methods to object methods - Document builder methods, add
{@link ...}from object methods to builder methods - Explore exposing code-generated builders as directly public (right now, the generated code is package private); this would be similar to option 2, but we would automatically inherit
{@link ...}from the generated code. As an example, here is what the auto-generated javadoc from immutables looks like:
/**
* Initializes the value for the {@link ServerConfig#shutdownTimeout() shutdownTimeout} attribute.
* <p><em>If not set, this attribute will have a default value as returned by the initializer of {@link ServerConfig#shutdownTimeout() shutdownTimeout}.</em>
* @param shutdownTimeout The value for shutdownTimeout
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder shutdownTimeout(Duration shutdownTimeout) {Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationfeature requestNew feature or requestNew feature or request