/** * Copy the current immutable object by setting a value for the {@link Agent#getDebugConfig() debugConfig} 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 debugConfig (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableAgent withDebugConfig(@Nullable DebugConfig value) { if (this.debugConfig == value) return this; return new ImmutableAgent(this.config, value, this.member); }
/** * This instance is equal to all instances of {@code ImmutableAgent} that have equal attribute values. * @return {@code true} if {@code this} is equal to {@code another} instance */ @Override public boolean equals(@Nullable Object another) { if (this == another) return true; return another instanceof ImmutableAgent && equalTo((ImmutableAgent) another); }
/** * Creates an immutable copy of a {@link Agent} 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 Agent instance */ public static ImmutableAgent copyOf(Agent instance) { if (instance instanceof ImmutableAgent) { return (ImmutableAgent) instance; } return ImmutableAgent.builder() .from(instance) .build(); }
/** * @param json A JSON-bindable data structure * @return An immutable value type * @deprecated Do not use this method directly, it exists only for the <em>Jackson</em>-binding infrastructure */ @Deprecated @JsonCreator static ImmutableAgent fromJson(Json json) { ImmutableAgent.Builder builder = ImmutableAgent.builder(); if (json.config != null) { builder.config(json.config); } if (json.debugConfig != null) { builder.debugConfig(json.debugConfig); } if (json.member != null) { builder.member(json.member); } return builder.build(); }
/** * Copy the current immutable object by setting a value for the {@link Agent#getMember() member} 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 member * @return A modified copy of the {@code this} object */ public final ImmutableAgent withMember(Member value) { if (this.member == value) return this; return new ImmutableAgent( this.config, this.debugConfig, Preconditions.checkNotNull(value, "member")); }
/** * Copy the current immutable object by setting a value for the {@link Agent#getConfig() config} 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 config * @return A modified copy of the {@code this} object */ public final ImmutableAgent withConfig(Config value) { if (this.config == value) return this; return new ImmutableAgent( Preconditions.checkNotNull(value, "config"), this.debugConfig, this.member); }
/** * Builds a new {@link ImmutableAgent ImmutableAgent}. * @return An immutable instance of Agent * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableAgent build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new ImmutableAgent(config, debugConfig, member); }