/** * Copy the current immutable object with elements that replace the content of {@link Atoi#getArgs() args}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableAtoi withArgs(String... elements) { ImmutableList<String> newValue = ImmutableList.copyOf(elements); return new ImmutableAtoi(newValue, this.returnValue, this.name, this.description); }
/** * This instance is equal to all instances of {@code ImmutableAtoi} 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 ImmutableAtoi && equalTo((ImmutableAtoi) another); }
/** * Creates an immutable copy of a {@link Atoi} 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 Atoi instance */ public static ImmutableAtoi copyOf(Atoi instance) { if (instance instanceof ImmutableAtoi) { return (ImmutableAtoi) instance; } return ImmutableAtoi.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(mode = JsonCreator.Mode.DELEGATING) static ImmutableAtoi fromJson(Json json) { ImmutableAtoi.Builder builder = ImmutableAtoi.builder(); if (json.args != null) { builder.addAllArgs(json.args); } if (json.returnValue != null) { builder.returnValue(json.returnValue); } if (json.name != null) { builder.name(json.name); } if (json.description != null) { builder.description(json.description); } return builder.build(); }
@Override public List<Element> getElement(final LoadRunnerVUVisitor visitor, final MethodCall method, final MethodcallContext ctx) { Preconditions.checkNotNull(method); if(method.getParameters() == null || method.getParameters().size()!=1){ visitor.readSupportedFunctionWithWarn(method.getName(), ctx, method.getName() + " method must have a parameter"); return Collections.emptyList(); } visitor.readSupportedFunction(method.getName(), ctx); final String arg0 = MethodUtils.normalizeString(visitor.getLeftBrace(), visitor.getRightBrace(), method.getParameters().get(0)); final List<String> args = ImmutableList.of(arg0); final String name = "atoi_" + counter.incrementAndGet(); return ImmutableList.of(ImmutableAtoi.builder().name(name).args(args).returnValue(MethodUtils.getVariableSyntax(name)).build()); } }
/** * Copy the current immutable object with elements that replace the content of {@link Atoi#getArgs() args}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of args elements to set * @return A modified copy of {@code this} object */ public final ImmutableAtoi withArgs(Iterable<String> elements) { if (this.args == elements) return this; ImmutableList<String> newValue = ImmutableList.copyOf(elements); return new ImmutableAtoi(newValue, this.returnValue, this.name, this.description); }
/** * Copy the current immutable object by setting a value for the {@link Atoi#getName() name} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for name * @return A modified copy of the {@code this} object */ public final ImmutableAtoi withName(String value) { if (this.name.equals(value)) return this; String newValue = Objects.requireNonNull(value, "name"); return new ImmutableAtoi(this.args, this.returnValue, newValue, this.description); }
/** * Copy the current immutable object by setting a value for the {@link Atoi#getReturnValue() returnValue} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for returnValue * @return A modified copy of the {@code this} object */ public final ImmutableAtoi withReturnValue(String value) { if (this.returnValue.equals(value)) return this; String newValue = Objects.requireNonNull(value, "returnValue"); return new ImmutableAtoi(this.args, newValue, this.name, this.description); }
/** * Copy the current immutable object by setting an optional value for the {@link Atoi#getDescription() description} attribute. * An equality check is used on inner nullable value to prevent copying of the same value by returning {@code this}. * @param optional A value for description * @return A modified copy of {@code this} object */ public final ImmutableAtoi withDescription(Optional<String> optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.description, value)) return this; return new ImmutableAtoi(this.args, this.returnValue, this.name, value); }
/** * Copy the current immutable object by setting a <i>present</i> value for the optional {@link Atoi#getDescription() description} attribute. * @param value The value for description * @return A modified copy of {@code this} object */ public final ImmutableAtoi withDescription(String value) { @Nullable String newValue = Objects.requireNonNull(value, "description"); if (Objects.equals(this.description, newValue)) return this; return new ImmutableAtoi(this.args, this.returnValue, this.name, newValue); }
/** * Builds a new {@link ImmutableAtoi ImmutableAtoi}. * @return An immutable instance of Atoi * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableAtoi build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new ImmutableAtoi(args.build(), returnValue, name, description); }