This is an automated email from the ASF dual-hosted git repository. markap14 pushed a commit to branch NIFI-15258 in repository https://gitbox.apache.org/repos/asf/nifi-api.git
commit 6a7f7ff5549fa16763753013cb2151f6294b76fa Author: Mark Payne <[email protected]> AuthorDate: Thu Jan 15 11:08:31 2026 -0500 NIFI-15446: Updated JavaDocs to clarify how invocations of Connector Methods work (#45) --- .../components/ControllerServiceFacade.java | 29 ++++++++++++++++++++++ .../connector/components/ProcessorFacade.java | 29 ++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/src/main/java/org/apache/nifi/components/connector/components/ControllerServiceFacade.java b/src/main/java/org/apache/nifi/components/connector/components/ControllerServiceFacade.java index b0eae11..288bcdc 100644 --- a/src/main/java/org/apache/nifi/components/connector/components/ControllerServiceFacade.java +++ b/src/main/java/org/apache/nifi/components/connector/components/ControllerServiceFacade.java @@ -43,8 +43,37 @@ public interface ControllerServiceFacade { List<ConfigVerificationResult> verify(VersionedExternalFlow versionedExternalFlow, Map<String, String> variables); + /** + * <p> + * Invokes the {@link ConnectorMethod} with the given name, passing in the provided arguments. The arguments Map will be + * serialized into JSON. This provides the ability to pass complex data structures but means that arbitrary objects that + * contain methods will not be provided as-is. This is necessary due to ClassLoader isolation. + * </p> + * <p> + * Likewise, the return value will be deserialized from JSON into a standard Java object. Depending on the value returned, + * the returned object may be a primitive, a String, List, Map, etc. Complex objects will be represented as Maps of property names to values. + * </p> + * + * @param methodName the name of the ConnectorMethod to invoke + * @param arguments the arguments to pass to the method + * @return the result of the method invocation, deserialized from JSON + * @throws InvocationFailedException if unable to invoke the method + */ Object invokeConnectorMethod(String methodName, Map<String, Object> arguments) throws InvocationFailedException; + /** + * Invokes the {@link ConnectorMethod} with the given name, passing in the provided arguments. The arguments + * Map will be serialized into JSON. This provides the ability to pass complex data structures but means that + * arbitrary objects that contain methods will not be provided as-is. This is necessary due to ClassLoader + * isolation. + * + * @param methodName the name of the ConnectorMethod to invoke + * @param arguments the arguments to pass to the method + * @param returnType the expected return type + * @return the result of the method invocation, deserialized from JSON into the specified return type + * @param <T> the expected return type + * @throws InvocationFailedException if unable to invoke the method + */ <T> T invokeConnectorMethod(String methodName, Map<String, Object> arguments, Class<T> returnType) throws InvocationFailedException; } diff --git a/src/main/java/org/apache/nifi/components/connector/components/ProcessorFacade.java b/src/main/java/org/apache/nifi/components/connector/components/ProcessorFacade.java index bfa32b8..bb57e3f 100644 --- a/src/main/java/org/apache/nifi/components/connector/components/ProcessorFacade.java +++ b/src/main/java/org/apache/nifi/components/connector/components/ProcessorFacade.java @@ -43,7 +43,36 @@ public interface ProcessorFacade { List<ConfigVerificationResult> verify(VersionedExternalFlow versionedExternalFlow, Map<String, String> attributes); + /** + * <p> + * Invokes the {@link ConnectorMethod} with the given name, passing in the provided arguments. The arguments Map will be + * serialized into JSON. This provides the ability to pass complex data structures but means that arbitrary objects that + * contain methods will not be provided as-is. This is necessary due to ClassLoader isolation. + * </p> + * <p> + * Likewise, the return value will be deserialized from JSON into a standard Java object. Depending on the value returned, + * the returned object may be a primitive, a String, List, Map, etc. Complex objects will be represented as Maps of property names to values. + * </p> + * + * @param methodName the name of the ConnectorMethod to invoke + * @param arguments the arguments to pass to the method + * @return the result of the method invocation, deserialized from JSON + * @throws InvocationFailedException if unable to invoke the method + */ Object invokeConnectorMethod(String methodName, Map<String, Object> arguments) throws InvocationFailedException; + /** + * Invokes the {@link ConnectorMethod} with the given name, passing in the provided arguments. The arguments + * Map will be serialized into JSON. This provides the ability to pass complex data structures but means that + * arbitrary objects that contain methods will not be provided as-is. This is necessary due to ClassLoader + * isolation. + * + * @param methodName the name of the ConnectorMethod to invoke + * @param arguments the arguments to pass to the method + * @param returnType the expected return type + * @return the result of the method invocation, deserialized from JSON into the specified return type + * @param <T> the expected return type + * @throws InvocationFailedException if unable to invoke the method + */ <T> T invokeConnectorMethod(String methodName, Map<String, Object> arguments, Class<T> returnType) throws InvocationFailedException; }
