public final class CreateDescriptor extends Object
FileBuilder
and is sent out to
CreateFromTemplateAttributes
and CreateFromTemplateHandler
SPIs as the context for their work.
The class is not thread-safe. Do not access the descriptor from a thread other
than executing the CreateFromTemplateHandler
callbacks.
Modifier and Type | Field and Description |
---|---|
static String |
FREE_FILE_EXTENSION
Parameter to enable free file extension mode.
|
static String |
PREFORMATTED_TEMPLATE
Specifies that no formatting or indentation should be performed on the template.
|
Modifier and Type | Method and Description |
---|---|
Locale |
getLocale()
Provides the desired user locale for creating the template
|
Lookup |
getLookup()
Lookup that may contain additional services or instructions for
the template creation.
|
String |
getName()
Provides the desired name for the created file.
|
Map<String,Object> |
getParameters()
Provides access to the complete parameter map.
|
String |
getProposedName()
Provides a name proposed for the file.
|
FileObject |
getTarget() |
FileObject |
getTemplate() |
<T> T |
getValue(String n)
Provides value for the named key.
|
boolean |
hasFreeExtension()
Specifies whether the extension should be taken from the specified name,
or the extension is fixed to the template's one.
|
boolean |
isPreformatted() |
public static final String FREE_FILE_EXTENSION
FileBuilder.createFromTemplate(org.openide.filesystems.FileObject, org.openide.filesystems.FileObject, java.lang.String, java.util.Map, org.netbeans.api.templates.FileBuilder.Mode)
is called with this
parameter set to Boolean.TRUE
and the file name already seems to
include an extension (*.*
), the handler should not append
any extension from the template.Templates.SimpleTargetChooserBuilder.freeFileExtension
,
Constant Field Valuespublic static final String PREFORMATTED_TEMPLATE
It's responsibility of CreateFromTemplateHandler
to pay attention to this value.
@NonNull public FileObject getTemplate()
@NonNull public FileObject getTarget()
@CheckForNull public String getName()
null
can be
returned to indicate the filename should be derived automatically.@NonNull public String getProposedName()
CreateDescriptor.getName()
. A handler is encouraged
to use the proposed name if it does not require a certain naming scheme.@NonNull public Locale getLocale()
@CheckForNull public <T> T getValue(String n)
CreateFromTemplateAttributes
implementors.T
- value type.n
- key namenull
if the key does not exist/has no value.@NonNull public Map<String,Object> getParameters()
public boolean hasFreeExtension()
public boolean isPreformatted()
public Lookup getLookup()