/** * @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(); }
/** * 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); }
/** * Fill a builder with attribute values from the provided {@code Agent} 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 from(Agent instance) { Preconditions.checkNotNull(instance, "instance"); config(instance.getConfig()); @Nullable DebugConfig debugConfigValue = instance.getDebugConfig(); if (debugConfigValue != null) { debugConfig(debugConfigValue); } member(instance.getMember()); return this; }
/** * 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(); }
/** * Creates a builder for {@link ImmutableAgent ImmutableAgent}. * @return A new ImmutableAgent builder */ public static ImmutableAgent.Builder builder() { return new ImmutableAgent.Builder(); }