/** * Builds a new {@link RangeInclusiveD RangeInclusiveD}. * @return An immutable instance of RangeInclusiveD * @throws java.lang.IllegalStateException if any required attributes are missing */ public RangeInclusiveD build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return RangeInclusiveD.validate(new RangeInclusiveD(lower, upper)); }
/** * Fill a builder with attribute values from the provided {@code RangeInclusiveDType} 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 */ public final Builder from(RangeInclusiveDType instance) { Objects.requireNonNull(instance, "instance"); setLower(instance.lower()); setUpper(instance.upper()); return this; }
/** * Creates an immutable copy of a {@link RangeInclusiveDType} 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 RangeInclusiveD instance */ public static RangeInclusiveD copyOf(RangeInclusiveDType instance) { if (instance instanceof RangeInclusiveD) { return (RangeInclusiveD) instance; } return RangeInclusiveD.builder() .from(instance) .build(); }
/** * Creates a builder for {@link RangeInclusiveD RangeInclusiveD}. * @return A new RangeInclusiveD builder */ public static RangeInclusiveD.Builder builder() { return new RangeInclusiveD.Builder(); }