@Override public List<Element> getElement(final LoadRunnerVUVisitor visitor, final MethodCall method, final MethodcallContext ctx) { if (method == null) { return Collections.emptyList(); } if (method.getParameters() == null || method.getParameters().isEmpty()) { visitor.readSupportedFunctionWithWarn(method.getName(), ctx, method.getName() + " must have a parameter."); return Collections.emptyList(); } visitor.readSupportedFunction(method.getName(), ctx); final String firstParameter = method.getParameters().get(0); final String transactionName = MethodUtils.normalizeName(firstParameter); final ImmutableContainer.Builder currentContainer = ImmutableContainer.builder().name(transactionName); visitor.getCurrentContainers().add(currentContainer); return Collections.emptyList(); } }
/** * Sets or replaces all elements for {@link Container#getChilds() childs} list. * @param elements An iterable of childs elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("childs") public final Builder childs(Iterable<? extends Element> elements) { this.childs = ImmutableList.builder(); return addAllChilds(elements); }
private static void addChild(final Object container, final Element element) { if (container instanceof ImmutableContainer.Builder) { ((ImmutableContainer.Builder) container).addChilds(element); return; } else if (container instanceof ImmutableContainerForMulti.Builder) { ((ImmutableContainerForMulti.Builder) container).addChilds(element); return; } ((Container) container).getChilds().add(element); }
/** * @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 ImmutableContainer fromJson(Json json) { ImmutableContainer.Builder builder = ImmutableContainer.builder(); if (json.childs != null) { builder.addAllChilds(json.childs); } if (json.isSharedIsSet) { builder.isShared(json.isShared); } if (json.name != null) { builder.name(json.name); } if (json.description != null) { builder.description(json.description); } return builder.build(); }
/** * Creates an immutable copy of a {@link Container} 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 Container instance */ public static ImmutableContainer copyOf(Container instance) { if (instance instanceof ImmutableContainer) { return (ImmutableContainer) instance; } return ImmutableContainer.builder() .from(instance) .build(); }
private void from(Object object) { if (object instanceof ShareableElement) { ShareableElement instance = (ShareableElement) object; isShared(instance.isShared()); } if (object instanceof IContainer) { IContainer instance = (IContainer) object; addAllChilds(instance.getChilds()); } if (object instanceof Element) { Element instance = (Element) object; name(instance.getName()); Optional<String> descriptionOptional = instance.getDescription(); if (descriptionOptional.isPresent()) { description(descriptionOptional); } } }
/** * Build the container if the parameter is an ImmutableContainer.Builder or return directly the MutableContainer. */ public static IContainer toContainer(final Object current) { if (current instanceof ImmutableContainer.Builder) { return ((ImmutableContainer.Builder) current).build(); } else if (current instanceof ImmutableContainerForMulti.Builder) { return ((ImmutableContainerForMulti.Builder) current).build(); } return (IContainer) current; }
/** * Fill a builder with attribute values from the provided {@code com.neotys.neoload.model.repository.Container} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder from(Container instance) { Objects.requireNonNull(instance, "instance"); from((Object) instance); return this; }
/** * Builds a new {@link ImmutableContainer ImmutableContainer}. * @return An immutable instance of Container * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableContainer build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new ImmutableContainer(this); }
/** * Fill a builder with attribute values from the provided {@code com.neotys.neoload.model.repository.IContainer} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder from(IContainer instance) { Objects.requireNonNull(instance, "instance"); from((Object) instance); return this; }
/** * Fill a builder with attribute values from the provided {@code com.neotys.neoload.model.core.ShareableElement} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder from(ShareableElement instance) { Objects.requireNonNull(instance, "instance"); from((Object) instance); return this; }
/** * Fill a builder with attribute values from the provided {@code com.neotys.neoload.model.core.Element} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder from(Element instance) { Objects.requireNonNull(instance, "instance"); from((Object) instance); return this; }
/** * Creates a builder for {@link ImmutableContainer ImmutableContainer}. * @return A new ImmutableContainer builder */ public static ImmutableContainer.Builder builder() { return new ImmutableContainer.Builder(); }