/** * Creates a derived instance of {@code Status} with the given description. * * @param description the new description of the {@code Status}. * @return The newly created {@code Status} with the given description. */ public Status withDescription(String description) { if (Objects.equal(this.description, description)) { return this; } return new Status(this.canonicalCode, description); }
/** * Creates a derived instance of {@code Status} with the given description. * * @param description the new description of the {@code Status}. * @return The newly created {@code Status} with the given description. * @since 0.5 */ public Status withDescription(@Nullable String description) { if (Utils.equalsObjects(this.description, description)) { return this; } return new Status(this.canonicalCode, description); }
private static List<Status> buildStatusList() { TreeMap<Integer, Status> canonicalizer = new TreeMap<Integer, Status>(); for (CanonicalCode code : CanonicalCode.values()) { Status replaced = canonicalizer.put(code.value(), new Status(code, null)); if (replaced != null) { throw new IllegalStateException( "Code value duplication between " + replaced.getCanonicalCode().name() + " & " + code.name()); } } return Collections.unmodifiableList(new ArrayList<Status>(canonicalizer.values())); }
private static List<Status> buildStatusList() { TreeMap<Integer, Status> canonicalizer = new TreeMap<Integer, Status>(); for (CanonicalCode code : CanonicalCode.values()) { Status replaced = canonicalizer.put(code.value(), new Status(code, null)); if (replaced != null) { throw new IllegalStateException( "Code value duplication between " + replaced.getCanonicalCode().name() + " & " + code.name()); } } return Collections.unmodifiableList(new ArrayList<Status>(canonicalizer.values())); }