Class ImmutableStructurizer.Statement.Builder

  • Direct Known Subclasses:
    Structurizer.Statement.Builder
    Enclosing class:
    ImmutableStructurizer.Statement

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

      • optBits

        private long optBits
      • annotations

        private final com.google.common.collect.ImmutableList.Builder<Code.Term> annotations
      • signature

        private final com.google.common.collect.ImmutableList.Builder<Code.Term> signature
      • parameters

        private final com.google.common.collect.ImmutableList.Builder<Code.Term> parameters
      • expression

        private final com.google.common.collect.ImmutableList.Builder<Code.Term> expression
      • block

        private final com.google.common.collect.ImmutableList.Builder<Code.Term> block
      • definitions

        private final com.google.common.collect.ImmutableList.Builder<Structurizer.Statement> definitions
      • name

        @Nullable
        private com.google.common.base.Optional<java.lang.String> name
    • Constructor Detail

      • Builder

        public Builder()
        Creates a builder for Statement instances.
         new Structurizer.Statement.Builder()
            .addAnnotations|addAllAnnotations(org.immutables.value.processor.encode.Code.Term) // annotations elements
            .addSignature|addAllSignature(org.immutables.value.processor.encode.Code.Term) // signature elements
            .addParameters|addAllParameters(org.immutables.value.processor.encode.Code.Term) // parameters elements
            .addExpression|addAllExpression(org.immutables.value.processor.encode.Code.Term) // expression elements
            .addBlock|addAllBlock(org.immutables.value.processor.encode.Code.Term) // block elements
            .addDefinitions|addAllDefinitions(org.immutables.value.processor.encode.Structurizer.Statement) // definitions elements
            .name(com.google.common.base.Optional&lt;String&gt;) // optional name
            .build();
         
    • Method Detail

      • addAllAnnotations

        public final Structurizer.Statement.Builder addAllAnnotations​(java.lang.Iterable<? extends Code.Term> elements)
        Adds elements to annotations list.
        Parameters:
        elements - An iterable of annotations elements
        Returns:
        this builder for use in a chained invocation
      • addSignature

        public final Structurizer.Statement.Builder addSignature​(Code.Term... elements)
        Adds elements to signature list.
        Parameters:
        elements - An array of signature elements
        Returns:
        this builder for use in a chained invocation
      • addAllSignature

        public final Structurizer.Statement.Builder addAllSignature​(java.lang.Iterable<? extends Code.Term> elements)
        Adds elements to signature list.
        Parameters:
        elements - An iterable of signature elements
        Returns:
        this builder for use in a chained invocation
      • addParameters

        public final Structurizer.Statement.Builder addParameters​(Code.Term... elements)
        Adds elements to parameters list.
        Parameters:
        elements - An array of parameters elements
        Returns:
        this builder for use in a chained invocation
      • addAllParameters

        public final Structurizer.Statement.Builder addAllParameters​(java.lang.Iterable<? extends Code.Term> elements)
        Adds elements to parameters list.
        Parameters:
        elements - An iterable of parameters elements
        Returns:
        this builder for use in a chained invocation
      • addExpression

        public final Structurizer.Statement.Builder addExpression​(Code.Term... elements)
        Adds elements to expression list.
        Parameters:
        elements - An array of expression elements
        Returns:
        this builder for use in a chained invocation
      • addAllExpression

        public final Structurizer.Statement.Builder addAllExpression​(java.lang.Iterable<? extends Code.Term> elements)
        Adds elements to expression list.
        Parameters:
        elements - An iterable of expression elements
        Returns:
        this builder for use in a chained invocation
      • addBlock

        public final Structurizer.Statement.Builder addBlock​(Code.Term... elements)
        Adds elements to block list.
        Parameters:
        elements - An array of block elements
        Returns:
        this builder for use in a chained invocation
      • addAllBlock

        public final Structurizer.Statement.Builder addAllBlock​(java.lang.Iterable<? extends Code.Term> elements)
        Adds elements to block list.
        Parameters:
        elements - An iterable of block elements
        Returns:
        this builder for use in a chained invocation
      • name

        public final Structurizer.Statement.Builder name​(com.google.common.base.Optional<java.lang.String> name)
        Initializes the value for the name attribute.

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

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

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

        private boolean nameIsSet()
      • checkNotIsSet

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