/** * Copy the current immutable object with elements that replace the content of {@link CReleaseType#items() items}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of items elements to set * @return A modified copy of {@code this} object */ public final CRelease withItems(Iterable<? extends CItem> elements) { if (this.items == elements) return this; List<CItem> newValue = createUnmodifiableList(false, createSafeList(elements, true, false)); return new CRelease(this, this.date, newValue, this.ticketSystemID, this.version); }
/** * This instance is equal to all instances of {@code CRelease} that have equal attribute values. * @return {@code true} if {@code this} is equal to {@code another} instance */ @Override public boolean equals(Object another) { if (this == another) return true; return another instanceof CRelease && equalTo((CRelease) another); }
private CRelease( LocalDate date, Iterable<? extends CItem> items, String ticketSystemID, CVersionType version) { this.date = Objects.requireNonNull(date, "date"); this.items = createUnmodifiableList(false, createSafeList(items, true, false)); this.ticketSystemID = Objects.requireNonNull(ticketSystemID, "ticketSystemID"); this.version = Objects.requireNonNull(version, "version"); }
line.setLength(0); if (config.showDates()) { line.append(DateTimeFormatter.ISO_DATE.format(r.date())); line.append(" "); line.append(c.project()); line.append(" "); line.append(r.version().toVersionString()); out.println(line.toString()); final URI sys = ticket_systems.get(r.ticketSystemID()); for (final CItem i : r.items()) { line.append(DateTimeFormatter.ISO_DATE.format(r.date())); line.append(" ");
private void writeRelease( final CChangelog changelog, final Document doc, final Element releases, final CRelease release) { row( doc, releases, this.date_terse_formatter.format(release.date().toLocalDate()), List.of(doc.createTextNode( new StringBuilder() .append("Release: ") .append(changelog.project().value()) .append(" ") .append(release.version().toVersionString()) .toString()))); for (final CChange change : release.changes()) { row( doc, releases, this.date_terse_formatter.format(change.date().toLocalDate()), this.transformChange(changelog, doc, release, change)); } }
private void writeRelease( final Document doc, final Element releases, final CVersionType version, final CRelease release) { final Element e_release = doc.createElementNS(this.schema_uri, "c:release"); e_release.setAttribute( "date", this.date_formatter.format(release.date())); e_release.setAttribute( "version", version.toVersionString()); e_release.setAttribute( "ticket-system", release.ticketSystemID()); final Element changes = doc.createElementNS(this.schema_uri, "c:changes"); release.changes().forEach( change -> this.writeChange(doc, changes, change)); e_release.appendChild(changes); releases.appendChild(e_release); }
e_id.setTextContent(r.version().toVersionString()); doc.createElementNS(ATOM_NS, "a:published"); final String time = this.date_formatter.format(r.date()); e_updated.setTextContent(time); e_published.setTextContent(time); .append(changelog.project().value()) .append(" ") .append(r.version().toVersionString()) .append(" released") .toString();
private void onEndRelease() { final CRelease r = this.release_builder.build(); this.changelog_builder.putReleases(r.version(), r); }
/** * Construct a new immutable {@code CRelease} instance. * @param date The value for the {@code date} attribute * @param items The value for the {@code items} attribute * @param ticketSystemID The value for the {@code ticketSystemID} attribute * @param version The value for the {@code version} attribute * @return An immutable CRelease instance */ public static CRelease of(LocalDate date, Iterable<? extends CItem> items, String ticketSystemID, CVersionType version) { return new CRelease(date, items, ticketSystemID, version); }
/** * Creates an immutable copy of a {@link CReleaseType} 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 CRelease instance */ public static CRelease copyOf(CReleaseType instance) { if (instance instanceof CRelease) { return (CRelease) instance; } return CRelease.builder() .from(instance) .build(); }
private static Node transformTicket( final CChangelog changelog, final Document doc, final CRelease release, final CTicketID ticket) { final CTicketSystem ticket_system = changelog.ticketSystems().get(release.ticketSystemID()).get(); final Element a = doc.createElement("a"); final String ticket_val = ticket.value(); final URI target = URI.create(ticket_system.uri().toString() + ticket_val); a.setAttribute("href", target.toString()); a.setTextContent(ticket_val); return a; }
line.setLength(0); if (config.showDates()) { line.append(DateTimeFormatter.ISO_DATE.format(r.date())); line.append(" "); line.append(c.project()); line.append(" "); line.append(r.version().toVersionString()); out.println(line.toString()); final URI sys = ticket_systems.get(r.ticketSystemID()); for (final CItem i : r.items()) { line.append(DateTimeFormatter.ISO_DATE.format(r.date())); line.append(" ");
this.writer.append(this.date_formatter.format(release.date())); this.writer.append(" "); this.writer.append(changelog.project().value()); this.writer.append(" "); this.writer.append(release.version().toVersionString()); this.writer.newLine(); release.changes().reverse().forEach(change -> { try { if (this.config.showDates()) {
/** * Serialize the given changelog to plain text. * * @param c The changelog * @param config The writer configuration * @param out The writer */ public static void writeChangelog( final CChangelog c, final CChangelogTextWriterConfiguration config, final PrintWriter out) { NullCheck.notNull(c, "Changelog"); NullCheck.notNull(config, "Configuration"); NullCheck.notNull(out, "Output"); final StringBuilder line = new StringBuilder(); for (final CRelease r : c.releases()) { final Optional<CVersionType> release_opt = config.release(); final boolean show; if (release_opt.isPresent()) { show = Objects.equals(r.version(), release_opt.get()); } else { show = true; } if (show) { showRelease(c, config, out, line, r); } } out.flush(); }
/** * Construct a new immutable {@code CRelease} instance. * @param date The value for the {@code date} attribute * @param items The value for the {@code items} attribute * @param ticketSystemID The value for the {@code ticketSystemID} attribute * @param version The value for the {@code version} attribute * @return An immutable CRelease instance */ public static CRelease of(LocalDate date, Iterable<? extends CItem> items, String ticketSystemID, CVersionType version) { return new CRelease(date, items, ticketSystemID, version); }
private CRelease( LocalDate date, Iterable<? extends CItem> items, String ticketSystemID, CVersionType version) { this.date = Objects.requireNonNull(date, "date"); this.items = createUnmodifiableList(false, createSafeList(items, true, false)); this.ticketSystemID = Objects.requireNonNull(ticketSystemID, "ticketSystemID"); this.version = Objects.requireNonNull(version, "version"); }
/** * Creates an immutable copy of a {@link CReleaseType} 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 CRelease instance */ public static CRelease copyOf(CReleaseType instance) { if (instance instanceof CRelease) { return (CRelease) instance; } return CRelease.builder() .from(instance) .build(); }
/** * Copy the current immutable object with elements that replace the content of {@link CReleaseType#items() items}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of items elements to set * @return A modified copy of {@code this} object */ public final CRelease withItems(Iterable<? extends CItem> elements) { if (this.items == elements) return this; List<CItem> newValue = createUnmodifiableList(false, createSafeList(elements, true, false)); return new CRelease(this, this.date, newValue, this.ticketSystemID, this.version); }
/** * Serialize the given changelog to plain text. * * @param c The changelog * @param config The writer configuration * @param out The writer */ public static void writeChangelog( final CChangelog c, final CChangelogTextWriterConfiguration config, final PrintWriter out) { NullCheck.notNull(c, "Changelog"); NullCheck.notNull(config, "Configuration"); NullCheck.notNull(out, "Output"); final StringBuilder line = new StringBuilder(); for (final CRelease r : c.releases()) { final Optional<CVersionType> release_opt = config.release(); final boolean show; if (release_opt.isPresent()) { show = Objects.equals(r.version(), release_opt.get()); } else { show = true; } if (show) { showRelease(c, config, out, line, r); } } out.flush(); }
/** * Copy the current immutable object by setting a value for the {@link CReleaseType#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 CRelease withDate(LocalDate value) { if (this.date == value) return this; LocalDate newValue = Objects.requireNonNull(value, "date"); return new CRelease(this, newValue, this.items, this.ticketSystemID, this.version); }