+ API allows to create new files based on templates. Scripting engines can be specified for + processing the template, or custom Handlers may be registered to process certain templates. +
++ A template can use places substituable with parameter values; certain well-known parameters are + predefined, if the caller does not provide its custom values. +
++ The feature will be fully covered by unit tests. +
++ October 2014 +
++ The most important and only use-case is a file that is being created from a system-provided, or user-defined + boilerplate (template). +
++ This utility standardizes the process to use files as blueprints to create new files. +
++ This module replaces some implementation in DataSystem APIs so the implementation + is usable even without DataSystems API itself. DataSystems API will use this + library. +
++ Yes. +
++ No. +
++ Yes. +
++ Requires JRE 7, for implementation reasons (AutoCloseable). +
++ JRE +
++ None. +
++ No native platform dependencies. +
++ No specific deploy dependencies. +
++ JARs only. +
++ Yes. +
++ Yes, except API. +
++ Anywhere. +
++ No. +
++ No. +
++ No. +
++ No. +
++ No. +
++ No. +
++ No. +
++ No. +
++ Yes. +
++ None. +
++ None. +
++ None. +
++ Uses Lookup to locate SPIs to fill in template parameters and process templates. +
++ No. +
++ No. +
++ No. +
++ No UI. +
++ Files are processed in-memory in documents; practical limits are imposed + by the platform's Document implementation. +
++ See 'perf-limit' +
++ No UI. +
++ No. +
++ XXX no answer for perf-scale +
++ No practical enforcement. +
++ No. +
++ No. +
++ No. +
++ No. +
++ No. +
++ No. +
++ No. +
++ No. +
++ No. +
+smart templating. * Implementations of this class can be registered in the global {@link org.openide.util.Lookup} * and allows anyone provide additional parameters to each {@link CreateFromTemplateHandler}s * when a template is instantiating. * Read more in the howto document. - * + * + * This interface supersedes {@code CreateFromTemplateAttributesProvider} in {@code openide.loaders} module. * @author Jaroslav Tulach * @since 6.3 */ -public interface CreateFromTemplateAttributesProvider { +public interface CreateFromTemplateAttributes { /** Called when a template is about to be instantiated to provide additional * values to the {@link CreateFromTemplateHandler} that will handle the * template instantiation. @@ -55,5 +57,5 @@ * @param name the name of the object to create * @return map of named objects, or null */ - Map
+ FileLock + implements AutoCloseable to work well in try-with-resources constructs. +
+openide.filesystems.templates
module; see javadoc for
+
+ TemplateUtils for details.
+ Templates.SimpleTargetChooserBuilder.freeFileExtension
- */
- public static final String FREE_FILE_EXTENSION = "freeFileExtension"; // NOI18N
-
+public abstract class CreateFromTemplateHandler extends org.netbeans.api.templates.CreateFromTemplateHandler {
}
diff --git a/openide.loaders/src/org/openide/loaders/DataObject.java b/openide.loaders/src/org/openide/loaders/DataObject.java
--- a/openide.loaders/src/org/openide/loaders/DataObject.java
+++ b/openide.loaders/src/org/openide/loaders/DataObject.java
@@ -1601,6 +1601,14 @@
}
}
+ public static Map