/** * Copy the current immutable object by setting a value for the {@link ThreadFactoryProvider#daemon() daemon} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for daemon * @return A modified copy of the {@code this} object */ public final ImmutableThreadFactoryProvider withDaemon(boolean value) { if (this.daemon == value) return this; return new ImmutableThreadFactoryProvider(this.namePrefix, this.logger, this.priority, value); }
/** * Construct a new immutable {@code ThreadFactoryProvider} instance. * @param namePrefix The value for the {@code namePrefix} attribute * @param logger The value for the {@code logger} attribute * @param priority The value for the {@code priority} attribute * @return An immutable ThreadFactoryProvider instance */ public static ImmutableThreadFactoryProvider of(String namePrefix, Logger logger, Optional<Integer> priority) { return new ImmutableThreadFactoryProvider(namePrefix, logger, priority); }
/** * Copy the current immutable object by setting a value for the {@link ThreadFactoryProvider#logger() logger} attribute. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for logger * @return A modified copy of the {@code this} object */ public final ImmutableThreadFactoryProvider withLogger(Logger value) { if (this.logger == value) return this; Logger newValue = Objects.requireNonNull(value, "logger"); return new ImmutableThreadFactoryProvider(this.namePrefix, newValue, this.priority, this.daemon); }
/** * Copy the current immutable object by setting a value for the {@link ThreadFactoryProvider#namePrefix() namePrefix} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for namePrefix * @return A modified copy of the {@code this} object */ public final ImmutableThreadFactoryProvider withNamePrefix(String value) { String newValue = Objects.requireNonNull(value, "namePrefix"); if (this.namePrefix.equals(newValue)) return this; return new ImmutableThreadFactoryProvider(newValue, this.logger, this.priority, this.daemon); }
/** * Copy the current immutable object by setting a <i>present</i> value for the optional {@link ThreadFactoryProvider#priority() priority} attribute. * @param value The value for priority * @return A modified copy of {@code this} object */ public final ImmutableThreadFactoryProvider withPriority(int value) { @Nullable Integer newValue = value; if (Objects.equals(this.priority, newValue)) return this; return new ImmutableThreadFactoryProvider(this.namePrefix, this.logger, newValue, this.daemon); }
/** * Copy the current immutable object by setting an optional value for the {@link ThreadFactoryProvider#priority() priority} attribute. * An equality check is used on inner nullable value to prevent copying of the same value by returning {@code this}. * @param optional A value for priority * @return A modified copy of {@code this} object */ public final ImmutableThreadFactoryProvider withPriority(Optional<Integer> optional) { @Nullable Integer value = optional.orElse(null); if (Objects.equals(this.priority, value)) return this; return new ImmutableThreadFactoryProvider(this.namePrefix, this.logger, value, this.daemon); }
/** * Builds a new {@link ImmutableThreadFactoryProvider ImmutableThreadFactoryProvider}. * @return An immutable instance of ThreadFactoryProvider * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableThreadFactoryProvider build() { checkRequiredAttributes(); return new ImmutableThreadFactoryProvider(this); }