Class MethodCallBuilder

    • Field Detail

      • builderMethods

        protected final List<Method> builderMethods
    • Constructor Detail

      • MethodCallBuilder

        protected MethodCallBuilder​(List<Method> builderMethods)
        This constructor is used by the DslCodeGenerator to instantiate MethodCallBuilders providing them their associated builder methods found in DSL classes registered on the DslCodeGenerator.
        Parameters:
        builderMethods - the list of builder methods found in the DSL classes associated to this MethodCallBuilder parent DSL test element
    • Method Detail

      • matches

        public abstract boolean matches​(MethodCallContext context)
        Allows checking if this builder can build method calls for the given context.

        This method is invoked in every registered MethodCallBuilder, until one is found that matches.

        Parameters:
        context - provides information used to determine if a method call might be created by this builder. For example: JMeter test plan tree node test element, parent context, a map of entries to host custom information, etc.
        Returns:
        true if this builder knows how to build a method call for the context, false otherwise.
        Since:
        0.52
      • buildMethodCall

        protected abstract MethodCall buildMethodCall​(MethodCallContext context)
        Generates the method call instance for the particular DSL test element.

        You can check DslTestPlan.CodeBuilder to get an idea of how a general implementation of this method looks like

        If you find a scenario where your MethodCallBuilder applies to the given context, but no code has to be generated for it, then use MethodCall.emptyCall() to return a call that generates no code.

        Parameters:
        context - provides all information that might be required to generate the method call. For example: JMeter test plan tree node test element, parent context, a map of entries to host custom information, etc.
        Returns:
        generated method call for the DSL test element.
      • buildMethodCall

        protected MethodCall buildMethodCall​(MethodParam... params)
        Builds a method call for the given set of parameters using one of registered builder methods.

        This method is the starting point for creating the MethodCall returned by buildMethodCall(MethodCallContext).

        Parameters:
        params - contains the list of parameters to find the proper builder method and associate to the method call. If the MethodCall accepts as parameter children DSL test elements, then remember adding an array class for ChildrenParam (eg: new ChildrenParam<>(TestPlanChild[].class)).
        Returns:
        generated method call.
        Throws:
        UnsupportedOperationException - if no builder method is found for the given parameters.
      • order

        public int order()
        This method allows specifying an order over builders.

        Low values for order will make builders execute first than higher values.

        This is handy when the order is relevant, for instance if a builder is more generic than others and should be used as fallback when others don't match.

        No need for specifying an order for each builder. In most of the cases using the default value is ok. Only overwrite when you need a specific order between builders (implementing fallback of builders).

        Returns:
        a number used to order this builder among other existing values.
        Since:
        0.60
      • propertyIterator2Stream

        protected static Stream<org.apache.jmeter.testelement.property.JMeterProperty> propertyIterator2Stream​(org.apache.jmeter.testelement.property.PropertyIterator iter)
      • getBuilderOptionName

        protected static String getBuilderOptionName​(Class<?> builderClass,
                                                     String optionName)