@FacetConstraints(value=@FacetConstraint(value=JavaSourceFacet.class,type=REQUIRED)) public abstract class AbstractJavaSourceCommand<SOURCETYPE extends org.jboss.forge.roaster.model.source.JavaSource<?>> extends AbstractProjectCommand
Constructor and Description |
---|
AbstractJavaSourceCommand() |
Modifier and Type | Method and Description |
---|---|
protected String |
calculateDefaultPackage(UIContext context) |
SOURCETYPE |
decorateSource(UIExecutionContext context,
Project project,
SOURCETYPE source)
Override this method to do any necessary work to customize the generated
JavaResource . |
Result |
execute(UIExecutionContext context)
Called when the
UICommand should be executed. |
UICommandMetadata |
getMetadata(UIContext context) |
protected UIInput<String> |
getNamed() |
protected UIInput<Boolean> |
getOverwrite() |
protected ProjectFactory |
getProjectFactory()
Returns a reference to the
ProjectFactory . |
protected abstract Class<SOURCETYPE> |
getSourceType()
Get the
JavaSource type for which this command should create a new source file. |
protected UIInput<String> |
getTargetPackage() |
protected abstract String |
getType()
Get the type for which this command should create a new source file.
|
void |
initializeUI(UIBuilder builder)
Called before rendering the UI.
|
protected boolean |
isProjectRequired()
Implementations should return
true if a Project is required in order for this command to
execute. |
void |
validate(UIValidationContext validator)
Validate the current
UICommand . |
containsProject, getSelectedProject, getSelectedProject, isEnabled
public void initializeUI(UIBuilder builder) throws Exception
UICommand
InputComponent
objects to be displayed in the provided
UIBuilder
builder
- The builder on which the UI should be built upon. Never nullException
- if anything wrong happenspublic UICommandMetadata getMetadata(UIContext context)
getMetadata
in interface UICommand
getMetadata
in class AbstractUICommand
context
- the UIContext
provided by the UI implementation, never nullprotected abstract String getType()
protected abstract Class<SOURCETYPE> getSourceType()
JavaSource
type for which this command should create a new source file.public void validate(UIValidationContext validator)
UICommand
UICommand
.validate
in interface UICommand
validate
in class AbstractUICommand
public Result execute(UIExecutionContext context) throws Exception
UICommand
UICommand
should be executed.
This method should NEVER execute if UICommand.isEnabled(UIContext)
returns false and
UICommand.validate(UIValidationContext)
contains validation errorspublic SOURCETYPE decorateSource(UIExecutionContext context, Project project, SOURCETYPE source) throws Exception
JavaResource
.Exception
protected boolean isProjectRequired()
AbstractProjectCommand
true
if a Project
is required in order for this command to
execute. If false
, this command will run without a Project
selected in the current
UIContext
. Returning true
also enables the use of FacetConstraints
on the
implementation Class
declaration.isProjectRequired
in class AbstractProjectCommand
protected ProjectFactory getProjectFactory()
AbstractProjectCommand
ProjectFactory
.getProjectFactory
in class AbstractProjectCommand
Copyright © 2015 JBoss by Red Hat. All rights reserved.