pvillard31 commented on code in PR #11130:
URL: https://github.com/apache/nifi/pull/11130#discussion_r3262077713
##########
nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/parameter/ParameterContext.java:
##########
@@ -188,4 +188,22 @@ public interface ParameterContext extends ParameterLookup,
ComponentAuthorizable
* @return True if this inherits from the given ParameterContext
*/
boolean inheritsFrom(String parameterContextId);
+
+ /**
+ * Extracts the referenced parameter name from a one-to-one parameter
value reference.
+ * A one-to-one reference is a parameter value whose entire content is
exactly <code>#{parameterName}</code>
+ * with no surrounding text.
+ *
+ * @param value the parameter value to check
+ * @return the referenced parameter name if the value is a one-to-one
reference, or null otherwise
+ */
+ static String extractOneToOneParameterReference(final String value) {
+ if (value == null || value.length() < 4) {
+ return null;
+ }
+ if (value.startsWith("#{") && value.endsWith("}") &&
value.indexOf('}') == value.length() - 1) {
Review Comment:
Yeah, fair, I went for the easiest approach but you're absolutely right,
especially with provided parameters, we may have names where simple quoting
will be cleaner.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]