/** * Construct a new immutable {@code CItem} instance. * @param date The value for the {@code date} attribute * @param summary The value for the {@code summary} attribute * @param tickets The value for the {@code tickets} attribute * @param type The value for the {@code type} attribute * @return An immutable CItem instance */ public static CItem of(LocalDate date, String summary, Iterable<String> tickets, CChangeType type) { return new CItem(date, summary, tickets, type); }
/** * Construct a new immutable {@code CItem} instance. * @param date The value for the {@code date} attribute * @param summary The value for the {@code summary} attribute * @param tickets The value for the {@code tickets} attribute * @param type The value for the {@code type} attribute * @return An immutable CItem instance */ public static CItem of(LocalDate date, String summary, Iterable<String> tickets, CChangeType type) { return new CItem(date, summary, tickets, type); }
/** * Copy the current immutable object by setting a value for the {@link CItemType#type() type} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for type * @return A modified copy of the {@code this} object */ public final CItem withType(CChangeType value) { if (this.type == value) return this; CChangeType newValue = Objects.requireNonNull(value, "type"); return new CItem(this, this.date, this.summary, this.tickets, newValue); }
/** * Copy the current immutable object by setting a value for the {@link CItemType#date() date} 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 date * @return A modified copy of the {@code this} object */ public final CItem withDate(LocalDate value) { if (this.date == value) return this; LocalDate newValue = Objects.requireNonNull(value, "date"); return new CItem(this, newValue, this.summary, this.tickets, this.type); }
/** * Copy the current immutable object by setting a value for the {@link CItemType#type() type} 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 type * @return A modified copy of the {@code this} object */ public final CItem withType(CChangeType value) { if (this.type == value) return this; CChangeType newValue = Objects.requireNonNull(value, "type"); return new CItem(this, this.date, this.summary, this.tickets, newValue); }
/** * Copy the current immutable object by setting a value for the {@link CItemType#date() date} 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 date * @return A modified copy of the {@code this} object */ public final CItem withDate(LocalDate value) { if (this.date == value) return this; LocalDate newValue = Objects.requireNonNull(value, "date"); return new CItem(this, newValue, this.summary, this.tickets, this.type); }
/** * Copy the current immutable object by setting a value for the {@link CItemType#summary() summary} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for summary * @return A modified copy of the {@code this} object */ public final CItem withSummary(String value) { if (this.summary.equals(value)) return this; String newValue = Objects.requireNonNull(value, "summary"); return new CItem(this, this.date, newValue, this.tickets, this.type); }
/** * Copy the current immutable object by setting a value for the {@link CItemType#summary() summary} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for summary * @return A modified copy of the {@code this} object */ public final CItem withSummary(String value) { if (this.summary.equals(value)) return this; String newValue = Objects.requireNonNull(value, "summary"); return new CItem(this, this.date, newValue, this.tickets, this.type); }
/** * Builds a new {@link CItem CItem}. * @return An immutable instance of CItem * @throws java.lang.IllegalStateException if any required attributes are missing */ public CItem build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new CItem(null, date, summary, createUnmodifiableList(true, tickets), type); }
/** * Builds a new {@link CItem CItem}. * @return An immutable instance of CItem * @throws java.lang.IllegalStateException if any required attributes are missing */ public CItem build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new CItem(null, date, summary, createUnmodifiableList(true, tickets), type); }
/** * Copy the current immutable object with elements that replace the content of {@link CItemType#tickets() tickets}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final CItem withTickets(String... elements) { List<String> newValue = createUnmodifiableList(false, createSafeList(Arrays.asList(elements), true, false)); return new CItem(this, this.date, this.summary, newValue, this.type); }
/** * Copy the current immutable object with elements that replace the content of {@link CItemType#tickets() tickets}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final CItem withTickets(String... elements) { List<String> newValue = createUnmodifiableList(false, createSafeList(Arrays.asList(elements), true, false)); return new CItem(this, this.date, this.summary, newValue, this.type); }
/** * Copy the current immutable object with elements that replace the content of {@link CItemType#tickets() tickets}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of tickets elements to set * @return A modified copy of {@code this} object */ public final CItem withTickets(Iterable<String> elements) { if (this.tickets == elements) return this; List<String> newValue = createUnmodifiableList(false, createSafeList(elements, true, false)); return new CItem(this, this.date, this.summary, newValue, this.type); }
/** * Copy the current immutable object with elements that replace the content of {@link CItemType#tickets() tickets}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of tickets elements to set * @return A modified copy of {@code this} object */ public final CItem withTickets(Iterable<String> elements) { if (this.tickets == elements) return this; List<String> newValue = createUnmodifiableList(false, createSafeList(elements, true, false)); return new CItem(this, this.date, this.summary, newValue, this.type); }