本文整理汇总了Java中org.jboss.forge.addon.resource.Resource.exists方法的典型用法代码示例。如果您正苦于以下问题:Java Resource.exists方法的具体用法?Java Resource.exists怎么用?Java Resource.exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.forge.addon.resource.Resource
的用法示例。
在下文中一共展示了Resource.exists方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findPom
import org.jboss.forge.addon.resource.Resource; //导入方法依赖的package包/类
public static PomFileXml findPom(UIContext context, String project, File pomFile) {
if (pomFile == null) {
DirectoryResource initialDir = (DirectoryResource) context.getInitialSelection().get();
if (initialDir != null) {
Resource<?> child = initialDir.getChild(project + "/pom.xml");
if (child.exists()) {
pomFile = ResourceUtil.getContextFile(child);
}
}
}
if (Files.isFile(pomFile)) {
Document doc = null;
try {
doc = CheStackDetector.parseXmlFile(pomFile);
} catch (Exception e) {
LOG.debug("Failed to parse " + pomFile + " with: " + e, e);
}
return new PomFileXml(pomFile, doc);
}
return null;
}
示例2: processInclude
import org.jboss.forge.addon.resource.Resource; //导入方法依赖的package包/类
private String processInclude(Map<String, Object> dataModel)
{
Resource<?> resource = resourceFactory.create(getClass().getResource(
SCAFFOLD_DIR + source));
if (project.hasFacet(TemplateFacet.class))
{
TemplateFacet templates = project.getFacet(TemplateFacet.class);
Resource<?> templateResource = templates.getResource(source);
if (templateResource.exists())
{
resource = templateResource;
}
}
Template template = templateFactory.create(resource, FreemarkerTemplate.class);
String output = null;
try
{
output = template.process(dataModel);
}
catch (IOException ioEx)
{
throw new IllegalStateException(ioEx);
}
return output;
}
示例3: execute
import org.jboss.forge.addon.resource.Resource; //导入方法依赖的package包/类
@Override
public Resource<?> execute(ScaffoldResource scaffoldResource)
{
Resource<?> resource = resourceFactory.create(getClass().getResource(
SCAFFOLD_DIR + scaffoldResource.getSource()));
if (project.hasFacet(TemplateFacet.class))
{
TemplateFacet templates = project.getFacet(TemplateFacet.class);
Resource<?> templateResource = templates.getResource(scaffoldResource.getSource());
if (templateResource.exists())
{
resource = templateResource;
}
}
Template template = templateFactory.create(resource, FreemarkerTemplate.class);
String output = null;
try
{
output = template.process(dataModel);
}
catch (IOException ioEx)
{
throw new IllegalStateException(ioEx);
}
return ScaffoldUtil.createOrOverwrite(web.getWebResource(scaffoldResource.getDestination()), output);
}