Class ImmutableObjectMeta.Builder
- java.lang.Object
-
- org.apache.camel.k.tooling.maven.model.k8s.ImmutableObjectMeta.Builder
-
- Direct Known Subclasses:
ObjectMeta.Builder
- Enclosing class:
- ImmutableObjectMeta
public static class ImmutableObjectMeta.Builder extends Object
Builds instances of typeImmutableObjectMeta
. 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 forImmutableObjectMeta
instances.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImmutableObjectMeta
build()
Builds a newImmutableObjectMeta
.ObjectMeta.Builder
from(ObjectMeta instance)
Fill a builder with attribute values from the providedObjectMeta
instance.ObjectMeta.Builder
labels(Map<String,? extends String> entries)
Sets or replaces all mappings from the specified map as entries for thelabels
map.ObjectMeta.Builder
name(String name)
Initializes the value for thename
attribute.ObjectMeta.Builder
putAllLabels(Map<String,? extends String> entries)
Put all mappings from the specified map as entries tolabels
map.ObjectMeta.Builder
putLabels(String key, String value)
Put one entry to thelabels
map.ObjectMeta.Builder
putLabels(Map.Entry<String,? extends String> entry)
Put one entry to thelabels
map.
-
-
-
Constructor Detail
-
Builder
public Builder()
Creates a builder forImmutableObjectMeta
instances.new ObjectMeta.Builder() .name(String) // required
name
.putLabels|putAllLabels(String => String) //labels
mappings .build();
-
-
Method Detail
-
from
public final ObjectMeta.Builder from(ObjectMeta instance)
Fill a builder with attribute values from the providedObjectMeta
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
-
name
public final ObjectMeta.Builder name(String name)
Initializes the value for thename
attribute.- Parameters:
name
- The value for name- Returns:
this
builder for use in a chained invocation
-
putLabels
public final ObjectMeta.Builder putLabels(String key, String value)
Put one entry to thelabels
map.- Parameters:
key
- The key in the labels mapvalue
- The associated value in the labels map- Returns:
this
builder for use in a chained invocation
-
putLabels
public final ObjectMeta.Builder putLabels(Map.Entry<String,? extends String> entry)
Put one entry to thelabels
map. Nulls are not permitted- Parameters:
entry
- The key and value entry- Returns:
this
builder for use in a chained invocation
-
labels
public final ObjectMeta.Builder labels(Map<String,? extends String> entries)
Sets or replaces all mappings from the specified map as entries for thelabels
map. Nulls are not permitted- Parameters:
entries
- The entries that will be added to the labels map- Returns:
this
builder for use in a chained invocation
-
putAllLabels
public final ObjectMeta.Builder putAllLabels(Map<String,? extends String> entries)
Put all mappings from the specified map as entries tolabels
map. Nulls are not permitted- Parameters:
entries
- The entries that will be added to the labels map- Returns:
this
builder for use in a chained invocation
-
build
public ImmutableObjectMeta build()
Builds a newImmutableObjectMeta
.- Returns:
- An immutable instance of ObjectMeta
- Throws:
IllegalStateException
- if any required attributes are missing
-
-