private ImmutableListResult(ImmutableListResult.Builder<T> builder) { this.totalCount = builder.totalCount; this.items = builder.itemsIsSet() ? createUnmodifiableList(true, builder.items) : createUnmodifiableList(false, createSafeList(ListResult.super.getItems(), true, false)); }
static ModelExport of(final int version) { return ImmutableModelExport.builder().schemaVersion(version).build(); }
/** * Copy the current immutable object with elements that replace the content of {@link ListResult#getItems() 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 ImmutableListResult<T> withItems(Iterable<? extends T> elements) { if (this.items == elements) return this; List<T> newValue = createUnmodifiableList(false, createSafeList(elements, true, false)); return validate(new ImmutableListResult<T>(this, this.totalCount, newValue)); }
/** * Copy the current immutable object by setting a value for the {@link ResourceIdentifier#getKind() kind} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for kind (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableResourceIdentifier withKind(Kind value) { if (this.kind == value) return this; return validate(new ImmutableResourceIdentifier(this, value, this.name, this.version, this.id)); }
/** * Construct a new immutable {@code Violation} instance. * @param error The value for the {@code error} attribute * @param message The value for the {@code message} attribute * @param property The value for the {@code property} attribute * @return An immutable Violation instance */ public static Violation of(String error, String message, String property) { return validate(new ImmutableViolation(error, message, property)); }
/** * Copy the current immutable object by setting a value for the {@link ModelExport#schemaVersion() schemaVersion} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for schemaVersion * @return A modified copy of the {@code this} object */ public final ImmutableModelExport withSchemaVersion(int value) { if (this.schemaVersion == value) return this; return validate(new ImmutableModelExport(value)); }
/** * Construct a new immutable {@code EventMessage} instance. * @param event The value for the {@code event} attribute * @param data The value for the {@code data} attribute * @return An immutable EventMessage instance */ public static EventMessage of(Optional<String> event, Optional<Object> data) { return validate(new ImmutableEventMessage(event, data)); }
/** * Copy the current immutable object by setting a value for the {@link Dependency#getType() 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 (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableDependency withType(Dependency.Type value) { if (this.type == value) return this; return validate(new ImmutableDependency(value, this.id)); }
/** * Construct a new immutable {@code Split} instance. * @param language The value for the {@code language} attribute * @param expression The value for the {@code expression} attribute * @return An immutable Split instance */ public static Split of(Optional<String> language, Optional<String> expression) { return validate(new ImmutableSplit(language, expression)); }
/** * Construct a new immutable {@code ChangeEvent} instance. * @param action The value for the {@code action} attribute * @param kind The value for the {@code kind} attribute * @param id The value for the {@code id} attribute * @return An immutable ChangeEvent instance */ public static ChangeEvent of(Optional<String> action, Optional<String> kind, Optional<String> id) { return validate(new ImmutableChangeEvent(action, kind, id)); }
/** * Fill a builder with attribute values from the provided {@code ModelExport} instance. * Regular attribute values will be replaced with those from the given instance. * Absent optional values will not replace present values. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder createFrom(ModelExport instance) { Objects.requireNonNull(instance, "instance"); schemaVersion(instance.schemaVersion()); return this; }
/** * Builds a new {@link Dependency Dependency}. * @return An immutable instance of Dependency * @throws java.lang.IllegalStateException if any required attributes are missing */ public Dependency build() { return ImmutableDependency.validate(new ImmutableDependency(type, id)); } }
/** * Builds a new {@link Split Split}. * @return An immutable instance of Split * @throws java.lang.IllegalStateException if any required attributes are missing */ public Split build() { return ImmutableSplit.validate(new ImmutableSplit(null, language, expression)); } }
/** * Builds a new {@link EventMessage EventMessage}. * @return An immutable instance of EventMessage * @throws java.lang.IllegalStateException if any required attributes are missing */ public EventMessage build() { return ImmutableEventMessage.validate(new ImmutableEventMessage(null, event, data)); } }
/** * Builds a new {@link ModelExport ModelExport}. * @return An immutable instance of ModelExport * @throws java.lang.IllegalStateException if any required attributes are missing */ public ModelExport build() { return ImmutableModelExport.validate(new ImmutableModelExport(schemaVersion)); } }
/** * Builds a new {@link ResourceIdentifier ResourceIdentifier}. * @return An immutable instance of ResourceIdentifier * @throws java.lang.IllegalStateException if any required attributes are missing */ public ResourceIdentifier build() { return ImmutableResourceIdentifier.validate(new ImmutableResourceIdentifier(null, kind, name, version, id)); } }
/** * Creates a builder for {@link ModelExport ModelExport}. * @return A new ModelExport builder */ public static ImmutableModelExport.Builder builder() { return new ImmutableModelExport.Builder(); }
/** * Builds a new {@link ChangeEvent ChangeEvent}. * @return An immutable instance of ChangeEvent * @throws java.lang.IllegalStateException if any required attributes are missing */ public ChangeEvent build() { return ImmutableChangeEvent.validate(new ImmutableChangeEvent(null, action, kind, id)); } }
/** * Construct a new immutable {@code ResourceIdentifier} instance. * @param kind The value for the {@code kind} attribute * @param name The value for the {@code name} attribute * @param version The value for the {@code version} attribute * @param id The value for the {@code id} attribute * @return An immutable ResourceIdentifier instance */ public static ResourceIdentifier of(Kind kind, Optional<String> name, Optional<Integer> version, Optional<String> id) { return validate(new ImmutableResourceIdentifier(kind, name, version, id)); }