Review build abstraction Javadoc

This commit is contained in:
Stephane Nicoll
2019-10-03 14:59:21 +02:00
parent e0b274c383
commit 42c106b6e9
3 changed files with 58 additions and 2 deletions

View File

@@ -64,25 +64,46 @@ public abstract class Build {
public abstract BuildSettings getSettings();
/**
* Return the {@link PropertyContainer properties container} of this build.
* @return the properties container of this build.
* Return the {@linkplain PropertyContainer property container} to use to configure
* properties.
* @return the {@link PropertyContainer}
*/
public PropertyContainer properties() {
return this.properties;
}
/**
* Return the {@linkplain DependencyContainer dependency container} to use to
* configure dependencies.
* @return the {@link DependencyContainer}
*/
public DependencyContainer dependencies() {
return this.dependencies;
}
/**
* Return the {@linkplain BomContainer bom container} to use to configure Bill of
* Materials.
* @return the {@link BomContainer}
*/
public BomContainer boms() {
return this.boms;
}
/**
* Return the {@linkplain MavenRepositoryContainer repository container} to use to
* configure repositories.
* @return the {@link MavenRepositoryContainer} for repositories
*/
public MavenRepositoryContainer repositories() {
return this.repositories;
}
/**
* Return the {@linkplain MavenRepositoryContainer repository container} to use to
* configure plugin repositories.
* @return the {@link MavenRepositoryContainer} for plugin repositories
*/
public MavenRepositoryContainer pluginRepositories() {
return this.pluginRepositories;
}

View File

@@ -75,16 +75,31 @@ public class BuildSettings {
protected Builder() {
}
/**
* Set the group ID of the project.
* @param group the group ID
* @return this for method chaining
*/
public B group(String group) {
this.group = group;
return self();
}
/**
* Set the artifact ID of the project.
* @param artifact the artifact ID
* @return this for method chaining
*/
public B artifact(String artifact) {
this.artifact = artifact;
return self();
}
/**
* Set the version of the project.
* @param version the version
* @return this for method chaining
*/
public B version(String version) {
this.version = version;
return self();
@@ -95,6 +110,10 @@ public class BuildSettings {
return (B) this;
}
/**
* Build a {@link BuildSettings} with the current state of this builder.
* @return a {@link BuildSettings}
*/
public BuildSettings build() {
return new BuildSettings(this);
}

View File

@@ -54,10 +54,22 @@ public class Dependency {
this.exclusions = new LinkedHashSet<>(builder.exclusions);
}
/**
* Initialize a new dependency {@link Builder} with the specified coordinates.
* @param groupId the group ID of the dependency
* @param artifactId the artifact ID of the dependency
* @return a new builder
*/
public static Builder<?> withCoordinates(String groupId, String artifactId) {
return new Builder(groupId, artifactId);
}
/**
* Initialize a new dependency {@link Builder} with the state of the specified
* {@link Dependency}.
* @param dependency the dependency to use to initialize the builder
* @return a new builder initialized with the same state as the {@code dependency}
*/
public static Builder<?> from(Dependency dependency) {
return new Builder(dependency.getGroupId(), dependency.getArtifactId()).initialize(dependency);
}
@@ -183,6 +195,10 @@ public class Dependency {
return self();
}
/**
* Build a {@link Dependency} with the current state of this builder.
* @return a {@link Dependency}
*/
public Dependency build() {
return new Dependency(this);
}