org.immutables.fixture.jdkonly.ApplBuilder Maven / Gradle / Ivy
package org.immutables.fixture.jdkonly;
import com.google.common.base.Optional;
import java.util.Objects;
import java.util.OptionalInt;
import javax.annotation.Generated;
import javax.annotation.ParametersAreNonnullByDefault;
import javax.annotation.concurrent.NotThreadSafe;
/**
* {@code ApplBuilder} collects parameters and invokes the static factory method:
* {@code org.immutables.fixture.jdkonly.JdkOptionalBuilderFactory.appl(..)}.
* Call the {@link #build()} method to get a result of type {@code int}.
* {@code ApplBuilder} is not thread-safe and generally should not be stored in a field or collection,
* but instead used immediately to create instances.
*/
@SuppressWarnings("all")
@ParametersAreNonnullByDefault
@Generated({"Immutables.generator", "JdkOptionalBuilderFactory.appl"})
@NotThreadSafe
public final class ApplBuilder {
private Optional a = Optional.absent();
private java.util.Optional b = java.util.Optional.empty();
private OptionalInt c = OptionalInt.empty();
/**
* Creates a {@code ApplBuilder} factory builder.
*/
public ApplBuilder() {
}
/**
* Initializes the optional value {@code a} to a.
* @param a The value for a
* @return {@code this} builder for chained invocation
*/
public final ApplBuilder a(int a) {
this.a = Optional.of(a);
return this;
}
/**
* Initializes the optional value {@code a} to a.
* @param a The value for a
* @return {@code this} builder for use in a chained invocation
*/
public final ApplBuilder a(Optional a) {
this.a = Objects.requireNonNull(a, "a");
return this;
}
/**
* Initializes the optional value {@code b} to b.
* @param b The value for b
* @return {@code this} builder for chained invocation
*/
public final ApplBuilder b(String b) {
this.b = java.util.Optional.of(b);
return this;
}
/**
* Initializes the optional value {@code b} to b.
* @param b The value for b
* @return {@code this} builder for use in a chained invocation
*/
public final ApplBuilder b(java.util.Optional b) {
this.b = Objects.requireNonNull(b, "b");
return this;
}
/**
* Initializes the optional value {@code c} to c.
* @param c The value for c
* @return {@code this} builder for chained invocation
*/
public final ApplBuilder c(int c) {
this.c = OptionalInt.of(c);
return this;
}
/**
* Initializes the optional value {@code c} to c.
* @param c The value for c
* @return {@code this} builder for use in a chained invocation
*/
public final ApplBuilder c(OptionalInt c) {
this.c = Objects.requireNonNull(c, "c");
return this;
}
/**
* Invokes {@code org.immutables.fixture.jdkonly.JdkOptionalBuilderFactory.appl(..)} using the collected parameters and returns the result of the invocation
* @return A result of type {@code int}
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public int build() {
return JdkOptionalBuilderFactory.appl(a, b, c);
}
}