Package com.io7m.coffeepick.runtime
Class RuntimeDescription.Builder
java.lang.Object
com.io7m.coffeepick.runtime.RuntimeDescription.Builder
- Enclosing class:
- RuntimeDescription
public static final class RuntimeDescription.Builder
extends java.lang.Object
Builds instances of type
RuntimeDescription
.
Initialize attributes and then invoke the build()
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.
-
Method Summary
Modifier and Type Method Description RuntimeDescription.Builder
addAllTags(java.lang.Iterable<java.lang.String> elements)
Adds elements totags
set.RuntimeDescription.Builder
addTags(java.lang.String element)
Adds one element totags
set.RuntimeDescription.Builder
addTags(java.lang.String... elements)
Adds elements totags
set.RuntimeDescription
build()
Builds a newRuntimeDescription
.RuntimeDescription.Builder
from(RuntimeDescriptionType instance)
Fill a builder with attribute values from the providedRuntimeDescriptionType
instance.RuntimeDescription.Builder
setArchitecture(java.lang.String architecture)
Initializes the value for thearchitecture
attribute.RuntimeDescription.Builder
setArchiveHash(RuntimeHash archiveHash)
Initializes the value for thearchiveHash
attribute.RuntimeDescription.Builder
setArchiveSize(long archiveSize)
Initializes the value for thearchiveSize
attribute.RuntimeDescription.Builder
setArchiveURI(java.net.URI archiveURI)
Initializes the value for thearchiveURI
attribute.RuntimeDescription.Builder
setBuild(RuntimeBuild build)
Initializes the optional valuebuild
to build.RuntimeDescription.Builder
setBuild(java.util.Optional<? extends RuntimeBuild> build)
Initializes the optional valuebuild
to build.RuntimeDescription.Builder
setConfiguration(RuntimeConfiguration configuration)
Initializes the value for theconfiguration
attribute.RuntimeDescription.Builder
setPlatform(java.lang.String platform)
Initializes the value for theplatform
attribute.RuntimeDescription.Builder
setRepository(java.net.URI repository)
Initializes the value for therepository
attribute.RuntimeDescription.Builder
setTags(java.lang.Iterable<java.lang.String> elements)
Sets or replaces all elements fortags
set.RuntimeDescription.Builder
setVersion(RuntimeVersion version)
Initializes the value for theversion
attribute.RuntimeDescription.Builder
setVm(java.lang.String vm)
Initializes the value for thevm
attribute.
-
Method Details
-
from
Fill a builder with attribute values from the providedRuntimeDescriptionType
instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values. Collection elements and entries will be added, not replaced.- Parameters:
instance
- The instance from which to copy values- Returns:
this
builder for use in a chained invocation
-
setRepository
Initializes the value for therepository
attribute.- Parameters:
repository
- The value for repository- Returns:
this
builder for use in a chained invocation
-
setVersion
Initializes the value for theversion
attribute.- Parameters:
version
- The value for version- Returns:
this
builder for use in a chained invocation
-
setConfiguration
Initializes the value for theconfiguration
attribute.- Parameters:
configuration
- The value for configuration- Returns:
this
builder for use in a chained invocation
-
setPlatform
Initializes the value for theplatform
attribute.- Parameters:
platform
- The value for platform- Returns:
this
builder for use in a chained invocation
-
setArchitecture
Initializes the value for thearchitecture
attribute.- Parameters:
architecture
- The value for architecture- Returns:
this
builder for use in a chained invocation
-
setArchiveURI
Initializes the value for thearchiveURI
attribute.- Parameters:
archiveURI
- The value for archiveURI- Returns:
this
builder for use in a chained invocation
-
setArchiveSize
Initializes the value for thearchiveSize
attribute.- Parameters:
archiveSize
- The value for archiveSize- Returns:
this
builder for use in a chained invocation
-
setArchiveHash
Initializes the value for thearchiveHash
attribute.- Parameters:
archiveHash
- The value for archiveHash- Returns:
this
builder for use in a chained invocation
-
setVm
Initializes the value for thevm
attribute.- Parameters:
vm
- The value for vm- Returns:
this
builder for use in a chained invocation
-
setBuild
Initializes the optional valuebuild
to build.- Parameters:
build
- The value for build- Returns:
this
builder for chained invocation
-
setBuild
Initializes the optional valuebuild
to build.- Parameters:
build
- The value for build- Returns:
this
builder for use in a chained invocation
-
addTags
Adds one element totags
set.- Parameters:
element
- A tags element- Returns:
this
builder for use in a chained invocation
-
addTags
Adds elements totags
set.- Parameters:
elements
- An array of tags elements- Returns:
this
builder for use in a chained invocation
-
setTags
Sets or replaces all elements fortags
set.- Parameters:
elements
- An iterable of tags elements- Returns:
this
builder for use in a chained invocation
-
addAllTags
Adds elements totags
set.- Parameters:
elements
- An iterable of tags elements- Returns:
this
builder for use in a chained invocation
-
build
Builds a newRuntimeDescription
.- Returns:
- An immutable instance of RuntimeDescription
- Throws:
java.lang.IllegalStateException
- if any required attributes are missing
-