sdedic commented on a change in pull request #3262:
URL: https://github.com/apache/netbeans/pull/3262#discussion_r740147564
##########
File path:
platform/api.templates/src/org/netbeans/api/templates/CreateFromTemplateHandler.java
##########
@@ -59,4 +64,171 @@
CreateDescriptor desc
) throws IOException;
+ /**
+ * Replaces ${param} tokens in a String. The parameter reference has
syntax "${" paramName [":" defaultValue ] "}".
+ * Parameters are replaced recursively. "${" can be escaped by \, so "\${"
will not act as parameter reference start.
+ * @param expression string template
+ * @param parameters parameter values
+ * @return evaluated string.
+ * @since 1.23
+ */
+ public static String mapParameters(String expression, Map<String, ?>
parameters) {
Review comment:
Reuse: I don't think its's possible 'as is' as I'd like to keep the
default - which gives some troubles if the default itself contains delimiters
(see this impl). Also the replacement in MapFormat is not recursive - that
could be also solved by the caller by calling MapFormat repeatedly, but could
be added.
If you think it's worth moving to MapFormat, I'll try; but I'd like to
retain the `${...}` syntax, which is consistent with Ant, Freemarker or other
interpolation engines.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists