Class JavaNewInstanceOperation
java.lang.Object
org.mule.extensions.java.internal.operation.JavaNewInstanceOperation
Defines the operations of
JavaModule related to dynamic objects instantiation.- Since:
- 1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionnewInstance(ConstructorIdentifier identifier, Map<String, org.mule.runtime.api.metadata.TypedValue<Object>> args) Operation that allows the user to create a new instance of the givenclassThe identifier of theConstructorto be used includes theclassandconstructornames, being theconstructora full description of its signature including the types of each parameter.
-
Constructor Details
-
JavaNewInstanceOperation
public JavaNewInstanceOperation()
-
-
Method Details
-
newInstance
@Alias("new") @MediaType("application/java") @Throws(JavaNewInstanceErrorProvider.class) @OutputResolver(output=ConstructorTypeResolver.class) @Execution(CPU_LITE) public Object newInstance(@ParameterGroup(name="Constructor") @MetadataKeyId(ConstructorTypeResolver.class) ConstructorIdentifier identifier, @Optional @NullSafe @Content @TypeResolver(ConstructorTypeResolver.class) Map<String, org.mule.runtime.api.metadata.TypedValue<Object>> args) throws ClassNotFoundModuleException, NoSuchConstructorModuleException, ArgumentMismatchModuleException, InvocationModuleException, NonInstantiableTypeModuleExceptionOperation that allows the user to create a new instance of the givenclassThe identifier of theConstructorto be used includes theclassandconstructornames, being theconstructora full description of its signature including the types of each parameter.For example, if we want to invoke the constructor
Foo(String name, int age)which belongs toClassorg.bar.Foo, then the identifier of the method will be"Foo(String,int)"- Parameters:
identifier- the unique identifier for the constructor to be invokedargs- the arguments used to invoke the givenConstructor- Returns:
- a new instance of the given
class - Throws:
ClassNotFoundModuleException- if the givenclassis not found in the current contextNoSuchConstructorModuleException- if the givenclassdoes not declare a constructor with the given signatureArgumentMismatchModuleException- if themethodrequires a different set of arguments than the ones providedInvocationModuleException- if an error occurs during the execution of the methodNonInstantiableTypeModuleException- if the givenclassis not instantiable
-