/** * Sets or replaces all elements for {@link CItemType#tickets() tickets} list. * @param elements An iterable of tickets elements * @return {@code this} builder for use in a chained invocation */ public final Builder setTickets(Iterable<String> elements) { this.tickets.clear(); return addAllTickets(elements); }
/** * 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); }
/** * Fill a builder with attribute values from the provided {@code CItemType} instance. * Regular attribute values will be replaced with those from the given instance. * Absent optional values will not replace present values. * Collection elements and entries will be added, not replaced. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(CItemType instance) { Objects.requireNonNull(instance, "instance"); setDate(instance.date()); setSummary(instance.summary()); addAllTickets(instance.tickets()); setType(instance.type()); return this; }
/** * Fill a builder with attribute values from the provided {@code CItemType} instance. * Regular attribute values will be replaced with those from the given instance. * Absent optional values will not replace present values. * Collection elements and entries will be added, not replaced. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(CItemType instance) { Objects.requireNonNull(instance, "instance"); setDate(instance.date()); setSummary(instance.summary()); addAllTickets(instance.tickets()); setType(instance.type()); return this; }
/** * Creates an immutable copy of a {@link CItemType} 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 CItem instance */ public static CItem copyOf(CItemType instance) { if (instance instanceof CItem) { return (CItem) instance; } return CItem.builder() .from(instance) .build(); }
/** * Creates an immutable copy of a {@link CItemType} 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 CItem instance */ public static CItem copyOf(CItemType instance) { if (instance instanceof CItem) { return (CItem) instance; } return CItem.builder() .from(instance) .build(); }
/** * Creates a builder for {@link CItem CItem}. * @return A new CItem builder */ public static CItem.Builder builder() { return new CItem.Builder(); }
/** * 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); }
/** * Creates a builder for {@link CItem CItem}. * @return A new CItem builder */ public static CItem.Builder builder() { return new CItem.Builder(); }
/** * Sets or replaces all elements for {@link CItemType#tickets() tickets} list. * @param elements An iterable of tickets elements * @return {@code this} builder for use in a chained invocation */ public final Builder setTickets(Iterable<String> elements) { this.tickets.clear(); return addAllTickets(elements); }