Package com.epam.reportportal.utils
Class ParameterUtils
- java.lang.Object
-
- com.epam.reportportal.utils.ParameterUtils
-
public class ParameterUtils extends java.lang.ObjectA utility class for parameters read and processing.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringNULL_VALUE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringformatParametersAsTable(java.util.List<ParameterResource> parameters)Format parameters as Markdown table.static <T> java.util.List<ParameterResource>getParameters(java.lang.reflect.Executable method, java.util.List<T> parameterValues)Read all parameters from a method or a constructor and converts in into a list ofParameterResource.static <T> java.util.List<ParameterResource>getParameters(java.lang.String codeRef, java.util.List<org.apache.commons.lang3.tuple.Pair<java.lang.String,T>> parameters)Read all parameters from a method or a constructor and converts in into a list ofParameterResource.static java.lang.Class<?>toBoxedType(java.lang.Class<?> primitiveType)Converts primitive type to a corresponding boxed class, or returns the same instance if the input is not primitive.
-
-
-
Field Detail
-
NULL_VALUE
public static final java.lang.String NULL_VALUE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getParameters
@Nonnull public static <T> java.util.List<ParameterResource> getParameters(@Nonnull java.lang.reflect.Executable method, @Nullable java.util.List<T> parameterValues)
Read all parameters from a method or a constructor and converts in into a list ofParameterResource. RespectsParameterKeyannotation.- Type Parameters:
T- parameter values type- Parameters:
method- a method to read parametersparameterValues- a source of parameter values- Returns:
- a list of parameter POJOs with fulfilled name and value.
-
toBoxedType
public static java.lang.Class<?> toBoxedType(@Nonnull java.lang.Class<?> primitiveType)Converts primitive type to a corresponding boxed class, or returns the same instance if the input is not primitive.- Parameters:
primitiveType- a class which needs to be boxed- Returns:
- boxed class type
-
getParameters
@Nonnull public static <T> java.util.List<ParameterResource> getParameters(@Nullable java.lang.String codeRef, @Nullable java.util.List<org.apache.commons.lang3.tuple.Pair<java.lang.String,T>> parameters)
Read all parameters from a method or a constructor and converts in into a list ofParameterResource. RespectsParameterKeyannotation.- Type Parameters:
T- parameter values type- Parameters:
codeRef- a method reference to read parametersparameters- a source of parameter values and parameter names if not set byParameterKeyannotation- Returns:
- a list of parameter POJOs with fulfilled name and value.
-
formatParametersAsTable
@Nonnull public static java.lang.String formatParametersAsTable(@Nonnull java.util.List<ParameterResource> parameters)Format parameters as Markdown table.- Parameters:
parameters- list of parameters- Returns:
- text representation of parameter table
-
-