Class AttributeSpecBuilder<T>
Object
AttributeSpecBuilder<T>
- Type Parameters:
T
-
A builder for AttributeSpec.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
Parameter builder class, used to set specific parameters. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds the attribute spec.static AttributeSpecBuilder<Void>
create()
Creates an empty builder.static <T> AttributeSpecBuilder<T>
create
(AttributeSpec<T> sample) Creates a builder based on the given sample.static AttributeSpecBuilder<Void>
Creates a builder with the given attribute ID.static <T> AttributeSpecBuilder<T>
create
(String id, ValueFormat<T> format) Creates a builder with the given attribute ID and format.static <T> AttributeSpecBuilder<T>
Creates a builder with the given attribute ID, format and parameters.boolean
int
hashCode()
params()
Provides access toAttributeSpecBuilder.ParamsBuilder
, which is used to build parameter map.<R> AttributeSpecBuilder<R>
setFormat
(ValueFormat<R> format) Sets the value format.Sets the attribute id.toString()
-
Constructor Details
-
AttributeSpecBuilder
public AttributeSpecBuilder()
-
-
Method Details
-
create
Creates an empty builder.- Returns:
- builder
-
create
Creates a builder with the given attribute ID.- Parameters:
id
- attribute id- Returns:
- builder
-
create
@NotNull public static <T> AttributeSpecBuilder<T> create(@Nullable String id, @Nullable ValueFormat<T> format) Creates a builder with the given attribute ID and format.- Parameters:
id
- attribute idformat
- value format- Returns:
- builder
-
create
@NotNull public static <T> AttributeSpecBuilder<T> create(@Nullable String id, @Nullable ValueFormat<T> format, @Nullable Map<String, Object> params) Creates a builder with the given attribute ID, format and parameters. The parameters are copied from the passed map, so it can be reused by the calling code.- Parameters:
id
- attribute idformat
- value formatparams
- parameters map- Returns:
- builder
-
create
Creates a builder based on the given sample. Copies all the fields from the attribute spec.- Parameters:
sample
- sample attribute spec- Returns:
- builder
-
build
Builds the attribute spec.- Returns:
- attribute spec
- Throws:
IllegalArgumentException
- if there's anything wrong with id, format or parameters
-
setId
Sets the attribute id.- Parameters:
id
- attribute id- Returns:
- this builder
-
setFormat
Sets the value format.- Parameters:
format
- value format- Returns:
- this builder
-
params
Provides access toAttributeSpecBuilder.ParamsBuilder
, which is used to build parameter map.- Returns:
- parameter builder
-
equals
-
hashCode
public int hashCode() -
toString
-