Class ImmutableEncodedElement.Builder

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

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

      private static final long INIT_BIT_TYPE
      See Also:
    • INIT_BIT_NAMING

      private static final long INIT_BIT_NAMING
      See Also:
    • INIT_BIT_TYPE_PARAMETERS

      private static final long INIT_BIT_TYPE_PARAMETERS
      See Also:
    • OPT_BIT_STANDARD_NAMING

      private static final long OPT_BIT_STANDARD_NAMING
      See Also:
    • initBits

      private long initBits
    • optBits

      private long optBits
    • name

      @Nullable private String name
    • type

      @Nullable private Type type
    • naming

      @Nullable private Naming naming
    • params

      private final com.google.common.collect.ImmutableList.Builder<EncodedElement.Param> params
    • code

      private final com.google.common.collect.ImmutableList.Builder<Code.Term> code
    • thrown

      private final com.google.common.collect.ImmutableList.Builder<Type> thrown
    • tags

      private final com.google.common.collect.ImmutableSet.Builder<EncodedElement.Tag> tags
    • typeParameters

      @Nullable private Type.Parameters typeParameters
    • typeParams

      private final com.google.common.collect.ImmutableList.Builder<EncodedElement.TypeParam> typeParams
    • doc

      private final com.google.common.collect.ImmutableList.Builder<String> doc
    • annotations

      private final com.google.common.collect.ImmutableList.Builder<String> annotations
    • standardNaming

      @Nullable private StandardNaming standardNaming
  • Constructor Details

    • Builder

      public Builder()
      Creates a builder for EncodedElement instances.
       new EncodedElement.Builder()
          .name(String) // required name
          .type(org.immutables.value.processor.encode.Type) // required type
          .naming(org.immutables.generator.Naming) // required naming
          .addParams|addAllParams(org.immutables.value.processor.encode.EncodedElement.Param) // params elements
          .addCode|addAllCode(org.immutables.value.processor.encode.Code.Term) // code elements
          .addThrown|addAllThrown(org.immutables.value.processor.encode.Type) // thrown elements
          .addTags|addAllTags(org.immutables.value.processor.encode.EncodedElement.Tag) // tags elements
          .typeParameters(org.immutables.value.processor.encode.Type.Parameters) // required typeParameters
          .addTypeParams|addAllTypeParams(org.immutables.value.processor.encode.EncodedElement.TypeParam) // typeParams elements
          .addDoc|addAllDoc(String) // doc elements
          .addAnnotations|addAllAnnotations(String) // annotations elements
          .standardNaming(org.immutables.value.processor.encode.StandardNaming) // optional standardNaming
          .build();
       
  • Method Details

    • name

      public final EncodedElement.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
    • type

      public final EncodedElement.Builder type(Type type)
      Initializes the value for the type attribute.
      Parameters:
      type - The value for type
      Returns:
      this builder for use in a chained invocation
    • naming

      public final EncodedElement.Builder naming(Naming naming)
      Initializes the value for the naming attribute.
      Parameters:
      naming - The value for naming
      Returns:
      this builder for use in a chained invocation
    • addParams

      public final EncodedElement.Builder addParams(EncodedElement.Param element)
      Adds one element to params list.
      Parameters:
      element - A params element
      Returns:
      this builder for use in a chained invocation
    • addParams

      public final EncodedElement.Builder addParams(EncodedElement.Param... elements)
      Adds elements to params list.
      Parameters:
      elements - An array of params elements
      Returns:
      this builder for use in a chained invocation
    • addAllParams

      public final EncodedElement.Builder addAllParams(Iterable<? extends EncodedElement.Param> elements)
      Adds elements to params list.
      Parameters:
      elements - An iterable of params elements
      Returns:
      this builder for use in a chained invocation
    • addCode

      public final EncodedElement.Builder addCode(Code.Term element)
      Adds one element to code list.
      Parameters:
      element - A code element
      Returns:
      this builder for use in a chained invocation
    • addCode

      public final EncodedElement.Builder addCode(Code.Term... elements)
      Adds elements to code list.
      Parameters:
      elements - An array of code elements
      Returns:
      this builder for use in a chained invocation
    • addAllCode

      public final EncodedElement.Builder addAllCode(Iterable<? extends Code.Term> elements)
      Adds elements to code list.
      Parameters:
      elements - An iterable of code elements
      Returns:
      this builder for use in a chained invocation
    • addThrown

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

      public final EncodedElement.Builder addThrown(Type... elements)
      Adds elements to thrown list.
      Parameters:
      elements - An array of thrown elements
      Returns:
      this builder for use in a chained invocation
    • addAllThrown

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

      public final EncodedElement.Builder addTags(EncodedElement.Tag element)
      Adds one element to tags set.
      Parameters:
      element - A tags element
      Returns:
      this builder for use in a chained invocation
    • addTags

      public final EncodedElement.Builder addTags(EncodedElement.Tag... elements)
      Adds elements to tags set.
      Parameters:
      elements - An array of tags elements
      Returns:
      this builder for use in a chained invocation
    • addAllTags

      public final EncodedElement.Builder addAllTags(Iterable<EncodedElement.Tag> elements)
      Adds elements to tags set.
      Parameters:
      elements - An iterable of tags elements
      Returns:
      this builder for use in a chained invocation
    • typeParameters

      public final EncodedElement.Builder typeParameters(Type.Parameters typeParameters)
      Initializes the value for the typeParameters attribute.
      Parameters:
      typeParameters - The value for typeParameters
      Returns:
      this builder for use in a chained invocation
    • addTypeParams

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

      public final EncodedElement.Builder addTypeParams(EncodedElement.TypeParam... elements)
      Adds elements to typeParams list.
      Parameters:
      elements - An array of typeParams elements
      Returns:
      this builder for use in a chained invocation
    • addAllTypeParams

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

      public final EncodedElement.Builder addDoc(String element)
      Adds one element to doc list.
      Parameters:
      element - A doc element
      Returns:
      this builder for use in a chained invocation
    • addDoc

      public final EncodedElement.Builder addDoc(String... elements)
      Adds elements to doc list.
      Parameters:
      elements - An array of doc elements
      Returns:
      this builder for use in a chained invocation
    • addAllDoc

      public final EncodedElement.Builder addAllDoc(Iterable<String> elements)
      Adds elements to doc list.
      Parameters:
      elements - An iterable of doc elements
      Returns:
      this builder for use in a chained invocation
    • addAnnotations

      public final EncodedElement.Builder addAnnotations(String element)
      Adds one element to annotations list.
      Parameters:
      element - A annotations element
      Returns:
      this builder for use in a chained invocation
    • addAnnotations

      public final EncodedElement.Builder addAnnotations(String... elements)
      Adds elements to annotations list.
      Parameters:
      elements - An array of annotations elements
      Returns:
      this builder for use in a chained invocation
    • addAllAnnotations

      public final EncodedElement.Builder addAllAnnotations(Iterable<String> elements)
      Adds elements to annotations list.
      Parameters:
      elements - An iterable of annotations elements
      Returns:
      this builder for use in a chained invocation
    • standardNaming

      public final EncodedElement.Builder standardNaming(StandardNaming standardNaming)
      Initializes the value for the standardNaming attribute.

      If not set, this attribute will have a default value as returned by the initializer of standardNaming.

      Parameters:
      standardNaming - The value for standardNaming
      Returns:
      this builder for use in a chained invocation
    • build

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

      private boolean standardNamingIsSet()
    • nameIsSet

      private boolean nameIsSet()
    • typeIsSet

      private boolean typeIsSet()
    • namingIsSet

      private boolean namingIsSet()
    • typeParametersIsSet

      private boolean typeParametersIsSet()
    • checkNotIsSet

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

      private void checkRequiredAttributes()
    • formatRequiredAttributesMessage

      private String formatRequiredAttributesMessage()