/** * Copy the current immutable object by setting a value for the {@link RegexpValidator#getHaveToContains() haveToContains} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for haveToContains * @return A modified copy of the {@code this} object */ public final ImmutableRegexpValidator withHaveToContains(boolean value) { if (this.haveToContains == value) return this; return new ImmutableRegexpValidator(this.validationRegex, this.name, value); }
/** * Copy the current immutable object by setting a value for the {@link RegexpValidator#getValidationRegex() validationRegex} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for validationRegex * @return A modified copy of the {@code this} object */ public final ImmutableRegexpValidator withValidationRegex(String value) { if (this.validationRegex.equals(value)) return this; String newValue = Objects.requireNonNull(value, "validationRegex"); return new ImmutableRegexpValidator(newValue, this.name, this.haveToContains); }
/** * Copy the current immutable object by setting a value for the {@link RegexpValidator#getName() name} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for name * @return A modified copy of the {@code this} object */ public final ImmutableRegexpValidator withName(String value) { if (this.name.equals(value)) return this; String newValue = Objects.requireNonNull(value, "name"); return new ImmutableRegexpValidator(this.validationRegex, newValue, this.haveToContains); }
/** * Builds a new {@link ImmutableRegexpValidator ImmutableRegexpValidator}. * @return An immutable instance of RegexpValidator * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableRegexpValidator build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new ImmutableRegexpValidator(validationRegex, name, haveToContains); }