Class ImmutableEncodingInfo.Builder

  • Direct Known Subclasses:
    EncodingInfo.Builder
    Enclosing class:
    ImmutableEncodingInfo

    @NotThreadSafe
    public static class ImmutableEncodingInfo.Builder
    extends java.lang.Object
    Builds instances of type EncodingInfo. 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 Detail

      • INIT_BIT_TYPE_PARAMETERS

        private static final long INIT_BIT_TYPE_PARAMETERS
        See Also:
        Constant Field Values
      • initBits

        private long initBits
      • name

        @Nullable
        private java.lang.String name
      • imports

        private final com.google.common.collect.ImmutableSet.Builder<java.lang.String> imports
      • element

        private final com.google.common.collect.ImmutableList.Builder<EncodedElement> element
    • Constructor Detail

      • Builder

        public Builder()
        Creates a builder for EncodingInfo instances.
         new EncodingInfo.Builder()
            .name(String) // required name
            .addImports|addAllImports(String) // imports elements
            .typeParameters(org.immutables.value.processor.encode.Type.Parameters) // required typeParameters
            .typeFactory(org.immutables.value.processor.encode.Type.Factory) // required typeFactory
            .addElement|addAllElement(org.immutables.value.processor.encode.EncodedElement) // element elements
            .build();
         
    • Method Detail

      • name

        public final EncodingInfo.Builder name​(java.lang.String name)
        Initializes the value for the name attribute.
        Parameters:
        name - The value for name
        Returns:
        this builder for use in a chained invocation
      • addImports

        public final EncodingInfo.Builder addImports​(java.lang.String element)
        Adds one element to imports set.
        Parameters:
        element - A imports element
        Returns:
        this builder for use in a chained invocation
      • addImports

        public final EncodingInfo.Builder addImports​(java.lang.String... elements)
        Adds elements to imports set.
        Parameters:
        elements - An array of imports elements
        Returns:
        this builder for use in a chained invocation
      • addAllImports

        public final EncodingInfo.Builder addAllImports​(java.lang.Iterable<java.lang.String> elements)
        Adds elements to imports set.
        Parameters:
        elements - An iterable of imports elements
        Returns:
        this builder for use in a chained invocation
      • typeParameters

        public final EncodingInfo.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
      • typeFactory

        public final EncodingInfo.Builder typeFactory​(Type.Factory typeFactory)
        Initializes the value for the typeFactory attribute.
        Parameters:
        typeFactory - The value for typeFactory
        Returns:
        this builder for use in a chained invocation
      • addElement

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

        public final EncodingInfo.Builder addElement​(EncodedElement... elements)
        Adds elements to element list.
        Parameters:
        elements - An array of element elements
        Returns:
        this builder for use in a chained invocation
      • addAllElement

        public final EncodingInfo.Builder addAllElement​(java.lang.Iterable<? extends EncodedElement> elements)
        Adds elements to element list.
        Parameters:
        elements - An iterable of element elements
        Returns:
        this builder for use in a chained invocation
      • build

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

        private boolean nameIsSet()
      • typeParametersIsSet

        private boolean typeParametersIsSet()
      • typeFactoryIsSet

        private boolean typeFactoryIsSet()
      • checkNotIsSet

        private static void checkNotIsSet​(boolean isSet,
                                          java.lang.String name)
      • checkRequiredAttributes

        private void checkRequiredAttributes()
      • formatRequiredAttributesMessage

        private java.lang.String formatRequiredAttributesMessage()