Class ImmutableMavenArtifact.Builder
- java.lang.Object
-
- org.apache.camel.k.tooling.maven.model.ImmutableMavenArtifact.Builder
-
- Direct Known Subclasses:
MavenArtifact.Builder
- Enclosing class:
- ImmutableMavenArtifact
public static class ImmutableMavenArtifact.Builder extends Object
Builds instances of typeImmutableMavenArtifact
. Initialize attributes and then invoke thebuild()
method to create an immutable instance.Builder
is not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.
-
-
Constructor Summary
Constructors Constructor Description Builder()
Creates a builder forImmutableMavenArtifact
instances.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MavenArtifact.Builder
artifactId(String artifactId)
Initializes the value for theartifactId
attribute.ImmutableMavenArtifact
build()
Builds a newImmutableMavenArtifact
.MavenArtifact.Builder
from(Artifact instance)
Fill a builder with attribute values from the providedorg.apache.camel.k.tooling.maven.model.Artifact
instance.MavenArtifact.Builder
from(MavenArtifact instance)
Fill a builder with attribute values from the providedorg.apache.camel.k.tooling.maven.model.MavenArtifact
instance.MavenArtifact.Builder
groupId(String groupId)
Initializes the value for thegroupId
attribute.MavenArtifact.Builder
version(String version)
Initializes the optional valueversion
to version.MavenArtifact.Builder
version(Optional<String> version)
Initializes the optional valueversion
to version.
-
-
-
Constructor Detail
-
Builder
public Builder()
Creates a builder forImmutableMavenArtifact
instances.new MavenArtifact.Builder() .groupId(String) // required
groupId
.artifactId(String) // requiredartifactId
.version(String) // optionalversion
.build();
-
-
Method Detail
-
from
public final MavenArtifact.Builder from(Artifact instance)
Fill a builder with attribute values from the providedorg.apache.camel.k.tooling.maven.model.Artifact
instance.- Parameters:
instance
- The instance from which to copy values- Returns:
this
builder for use in a chained invocation
-
from
public final MavenArtifact.Builder from(MavenArtifact instance)
Fill a builder with attribute values from the providedorg.apache.camel.k.tooling.maven.model.MavenArtifact
instance.- Parameters:
instance
- The instance from which to copy values- Returns:
this
builder for use in a chained invocation
-
groupId
public final MavenArtifact.Builder groupId(String groupId)
Initializes the value for thegroupId
attribute.- Parameters:
groupId
- The value for groupId- Returns:
this
builder for use in a chained invocation
-
artifactId
public final MavenArtifact.Builder artifactId(String artifactId)
Initializes the value for theartifactId
attribute.- Parameters:
artifactId
- The value for artifactId- Returns:
this
builder for use in a chained invocation
-
version
public final MavenArtifact.Builder version(String version)
Initializes the optional valueversion
to version.- Parameters:
version
- The value for version- Returns:
this
builder for chained invocation
-
version
public final MavenArtifact.Builder version(Optional<String> version)
Initializes the optional valueversion
to version.- Parameters:
version
- The value for version- Returns:
this
builder for use in a chained invocation
-
build
public ImmutableMavenArtifact build()
Builds a newImmutableMavenArtifact
.- Returns:
- An immutable instance of MavenArtifact
- Throws:
IllegalStateException
- if any required attributes are missing
-
-