Class MethodParam
- java.lang.Object
-
- us.abstracta.jmeter.javadsl.codegeneration.MethodParam
-
- Direct Known Subclasses:
ChildrenParam,DslResponseAssertion.CodeBuilder.StringsCollectionParam,DynamicParam,FixedParam
public abstract class MethodParam extends Object
Generates code for a MethodCall parameter.This class should be extended to implement custom types of parameters (eg: check
ContentTypeParam- Since:
- 0.45
-
-
Field Summary
Fields Modifier and Type Field Description protected Stringexpressionprotected Class<?>paramType
-
Constructor Summary
Constructors Modifier Constructor Description protectedMethodParam(Class<?> paramType, String expression)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringbuildCode(String indent)protected static StringbuildStringLiteral(String value, String indent)protected static Set<String>findConstantNames(Class<?> constantsHolderClass, Class<?> constantClass, Predicate<Field> filter)protected static <T> Map<T,String>findConstantNamesMap(Class<?> constantsHolderClass, Class<T> constantClass, Predicate<Field> filter)StringgetExpression()Set<String>getImports()Gets all classes that are required to be statically imported by generated code.Map<String,MethodCall>getMethodDefinitions()Set<String>getStaticImports()Gets all classes that are required to be imported by generated code.protected Class<?>getType()booleanisDefault()Allows checking if a parameter is set to the default value.protected booleanisIgnored()
-
-
-
Method Detail
-
getExpression
public String getExpression()
-
getType
protected Class<?> getType()
-
isDefault
public boolean isDefault()
Allows checking if a parameter is set to the default value.This is usually used in
MethodCallBuilderinstances to check if a parameter is set or not to some custom value, and some method chaingin is required or not.This method may, and is, overwritten by subclasses depending on the semantics of each type of parameter.
- Returns:
- true when the value is the default one or not specified (null), false otherwise.
-
isIgnored
protected boolean isIgnored()
-
getStaticImports
public Set<String> getStaticImports()
Gets all classes that are required to be imported by generated code.Override this method if you implement a custom MethodParam that requires some particular import.
- Returns:
- the set of required classes names that need to be imported by generated code.
-
getImports
public Set<String> getImports()
Gets all classes that are required to be statically imported by generated code.Override this method if you implement a custom MethodParam that requires some particular static import.
- Returns:
- the set of required classes names that need to be statically imported by generated code.
-
getMethodDefinitions
public Map<String,MethodCall> getMethodDefinitions()
-
findConstantNamesMap
protected static <T> Map<T,String> findConstantNamesMap(Class<?> constantsHolderClass, Class<T> constantClass, Predicate<Field> filter)
-
-