Class ParameterTransformer
java.lang.Object
org.mule.extensions.java.internal.transformer.ParameterTransformer
This class purpose is checking and transforming objects to a parameter type of a certain
Executable
When transforming an input into something that fits to an Executable's parameter, this class will make a best effort in
order to make this transformation possible. In case that the transformation requires to transform a Collection or
Map, a new instance will be created for it.- Since:
- 1.1
-
Constructor Summary
ConstructorsConstructorDescriptionParameterTransformer(Executable executable, org.mule.runtime.api.transformation.TransformationService transformationService, org.mule.runtime.core.api.el.ExpressionManager expressionManager) -
Method Summary
Modifier and TypeMethodDescriptionbooleanparameterNeedsTransformation(Object value, int parameterIndex) Method that allows to check if a value fits a certain argument of the executable.transformParameter(Object value, int parameterIndex) Method that makes a best efford to map an object to the type of a parameter of the excecutable.
-
Constructor Details
-
ParameterTransformer
public ParameterTransformer(Executable executable, org.mule.runtime.api.transformation.TransformationService transformationService, org.mule.runtime.core.api.el.ExpressionManager expressionManager) - Parameters:
executable- The executable whose parameters will be checked againstObjects.transformationService- An instance of aTransformationServiceuse to tranform parameters.expressionManager- An instance of aExpressionManagerused to execute DataWeave expressions.
-
-
Method Details
-
parameterNeedsTransformation
Method that allows to check if a value fits a certain argument of the executable. Generic values will only be checked forMapandCollectionvalues.- Parameters:
value- The value which type will be checked.parameterIndex- The index of the parameter in the executable arguments.- Returns:
- whether the value needs to be transformed in order to fit the parameter from the executable
-
transformParameter
Method that makes a best efford to map an object to the type of a parameter of the excecutable.MapandCollectionwill be replaced with new instances. Other object will remain the same instance if they do not need to be transformed. For example, if a list is transformed, a new list will be created and will contain the same instances from the former list that did not needed to be transformed and new instances for the ones being transformed.- Parameters:
value- The value that will be transformed.parameterIndex- The index of the parameter in the executable arguments.- Returns:
- The value transformed to fit the executable parameter.
-