/** * Copy the current immutable object with elements that replace the content of {@link Strcmp#getArgs() args}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableStrcmp withArgs(String... elements) { ImmutableList<String> newValue = ImmutableList.copyOf(elements); return new ImmutableStrcmp(newValue, this.returnValue, this.name, this.description); }
/** * This instance is equal to all instances of {@code ImmutableStrcmp} 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 ImmutableStrcmp && equalTo((ImmutableStrcmp) another); }
/** * Creates an immutable copy of a {@link Strcmp} 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 Strcmp instance */ public static ImmutableStrcmp copyOf(Strcmp instance) { if (instance instanceof ImmutableStrcmp) { return (ImmutableStrcmp) instance; } return ImmutableStrcmp.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 ImmutableStrcmp fromJson(Json json) { ImmutableStrcmp.Builder builder = ImmutableStrcmp.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()!=2){ visitor.readSupportedFunctionWithWarn(method.getName(), ctx, method.getName() + " method must have 2 parameters"); return Collections.emptyList(); } visitor.readSupportedFunction(method.getName(), ctx); final String s0 = method.getParameters().get(0); final String s1 = method.getParameters().get(1); final List<String> args = ImmutableList.of(s0, s1); final String name = "strcmp_" + counter.incrementAndGet(); return ImmutableList.of(ImmutableStrcmp.builder() .name(name) .args(args) .returnValue(MethodUtils.getVariableSyntax(name)) .build()); } }
/** * Copy the current immutable object with elements that replace the content of {@link Strcmp#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 ImmutableStrcmp withArgs(Iterable<String> elements) { if (this.args == elements) return this; ImmutableList<String> newValue = ImmutableList.copyOf(elements); return new ImmutableStrcmp(newValue, this.returnValue, this.name, this.description); }
/** * Copy the current immutable object by setting a value for the {@link Strcmp#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 ImmutableStrcmp withName(String value) { if (this.name.equals(value)) return this; String newValue = Objects.requireNonNull(value, "name"); return new ImmutableStrcmp(this.args, this.returnValue, newValue, this.description); }
/** * Copy the current immutable object by setting a value for the {@link Strcmp#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 ImmutableStrcmp withReturnValue(String value) { if (this.returnValue.equals(value)) return this; String newValue = Objects.requireNonNull(value, "returnValue"); return new ImmutableStrcmp(this.args, newValue, this.name, this.description); }
/** * Copy the current immutable object by setting an optional value for the {@link Strcmp#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 ImmutableStrcmp withDescription(Optional<String> optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.description, value)) return this; return new ImmutableStrcmp(this.args, this.returnValue, this.name, value); }
/** * Copy the current immutable object by setting a <i>present</i> value for the optional {@link Strcmp#getDescription() description} attribute. * @param value The value for description * @return A modified copy of {@code this} object */ public final ImmutableStrcmp withDescription(String value) { @Nullable String newValue = Objects.requireNonNull(value, "description"); if (Objects.equals(this.description, newValue)) return this; return new ImmutableStrcmp(this.args, this.returnValue, this.name, newValue); }
/** * Builds a new {@link ImmutableStrcmp ImmutableStrcmp}. * @return An immutable instance of Strcmp * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableStrcmp build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new ImmutableStrcmp(args.build(), returnValue, name, description); }