/** * Builds a new {@link ImmutableArgumentNumber ImmutableArgumentNumber}. * @return An immutable instance of ArgumentNumber * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableArgumentNumber build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new ImmutableArgumentNumber(index); }
/** * Fill a builder with attribute values from the provided {@code ArgumentNumber} instance. * Regular attribute values will be replaced with those from the given instance. * Absent optional values will not replace present values. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder from(ArgumentNumber instance) { Objects.requireNonNull(instance, "instance"); index(instance.getIndex()); return this; }
/** * Creates an immutable copy of a {@link ArgumentNumber} value. * Uses accessors to get values to initialize the new immutable instance. * If an instance is already immutable, it is returned as is. * @param instance The instance to copy * @return A copied immutable ArgumentNumber instance */ public static ImmutableArgumentNumber copyOf(ArgumentNumber instance) { if (instance instanceof ImmutableArgumentNumber) { return (ImmutableArgumentNumber) instance; } return ImmutableArgumentNumber.builder() .from(instance) .build(); }
/** * Creates a builder for {@link ImmutableArgumentNumber ImmutableArgumentNumber}. * @return A new ImmutableArgumentNumber builder */ public static ImmutableArgumentNumber.Builder builder() { return new ImmutableArgumentNumber.Builder(); }