Class ImmutableEncodedElement.TypeParam.Builder

java.lang.Object
org.immutables.value.processor.encode.ImmutableEncodedElement.TypeParam.Builder
Direct Known Subclasses:
EncodedElement.TypeParam.Builder
Enclosing class:
ImmutableEncodedElement.TypeParam

@NotThreadSafe public static class ImmutableEncodedElement.TypeParam.Builder extends Object
Builds instances of type TypeParam. 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.

  • Field Details

    • INIT_BIT_NAME

      private static final long INIT_BIT_NAME
      See Also:
    • initBits

      private long initBits
    • name

      @Nullable private String name
    • bounds

      private final com.google.common.collect.ImmutableList.Builder<Type.Defined> bounds
  • Constructor Details

    • Builder

      public Builder()
      Creates a builder for TypeParam instances.
       new EncodedElement.TypeParam.Builder()
          .name(String) // required name
          .addBounds|addAllBounds(org.immutables.value.processor.encode.Type.Defined) // bounds elements
          .build();
       
  • Method Details

    • name

      public final EncodedElement.TypeParam.Builder name(String name)
      Initializes the value for the name attribute.
      Parameters:
      name - The value for name
      Returns:
      this builder for use in a chained invocation
    • addBounds

      public final EncodedElement.TypeParam.Builder addBounds(Type.Defined element)
      Adds one element to bounds list.
      Parameters:
      element - A bounds element
      Returns:
      this builder for use in a chained invocation
    • addBounds

      public final EncodedElement.TypeParam.Builder addBounds(Type.Defined... elements)
      Adds elements to bounds list.
      Parameters:
      elements - An array of bounds elements
      Returns:
      this builder for use in a chained invocation
    • addAllBounds

      public final EncodedElement.TypeParam.Builder addAllBounds(Iterable<? extends Type.Defined> elements)
      Adds elements to bounds list.
      Parameters:
      elements - An iterable of bounds elements
      Returns:
      this builder for use in a chained invocation
    • build

      public EncodedElement.TypeParam build()
      Builds a new TypeParam.
      Returns:
      An immutable instance of TypeParam
      Throws:
      IllegalStateException - if any required attributes are missing
    • nameIsSet

      private boolean nameIsSet()
    • checkNotIsSet

      private static void checkNotIsSet(boolean isSet, String name)
    • checkRequiredAttributes

      private void checkRequiredAttributes()
    • formatRequiredAttributesMessage

      private String formatRequiredAttributesMessage()