Class AttributeSpecBuilder<T>

Object
AttributeSpecBuilder<T>
Type Parameters:
T -

@PublicApi public class AttributeSpecBuilder<T> extends Object
A builder for AttributeSpec.
  • Constructor Details

    • AttributeSpecBuilder

      public AttributeSpecBuilder()
  • Method Details

    • create

      @NotNull public static AttributeSpecBuilder<Void> create()
      Creates an empty builder.
      Returns:
      builder
    • create

      @NotNull public static AttributeSpecBuilder<Void> create(@Nullable String id)
      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 id
      format - 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 id
      format - value format
      params - parameters map
      Returns:
      builder
    • create

      public static <T> AttributeSpecBuilder<T> create(AttributeSpec<T> sample)
      Creates a builder based on the given sample. Copies all the fields from the attribute spec.
      Parameters:
      sample - sample attribute spec
      Returns:
      builder
    • build

      @NotNull public AttributeSpec<T> build()
      Builds the attribute spec.
      Returns:
      attribute spec
      Throws:
      IllegalArgumentException - if there's anything wrong with id, format or parameters
    • setId

      public AttributeSpecBuilder<T> setId(String id)
      Sets the attribute id.
      Parameters:
      id - attribute id
      Returns:
      this builder
    • setFormat

      public <R> AttributeSpecBuilder<R> setFormat(ValueFormat<R> format)
      Sets the value format.
      Parameters:
      format - value format
      Returns:
      this builder
    • params

      Provides access to AttributeSpecBuilder.ParamsBuilder, which is used to build parameter map.
      Returns:
      parameter builder
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object