本文整理了Java中org.jboss.forge.addon.resource.Resource.getName
方法的一些代码示例,展示了Resource.getName
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Resource.getName
方法的具体详情如下:
包路径:org.jboss.forge.addon.resource.Resource
类名称:Resource
方法名:getName
[英]Return the common name of the Resource. If it's a file, for instance, just the file name.
[中]返回资源的通用名称。例如,如果是一个文件,只需输入文件名即可。
代码示例来源:origin: org.jboss.forge.addon/templates-freemarker
public ResourceId(Resource<?> resource)
{
super();
this.id = resource.getName().toString();
this.resource = resource;
}
代码示例来源:origin: org.jboss.forge.addon/git-impl
@Override
public boolean accept(Resource<?> resource)
{
return resource.getName().endsWith(GITIGNORE);
}
};
代码示例来源:origin: org.jboss.forge.addon/maven-impl
@Override
public Resource<?> getChild(String name)
{
List<Resource<?>> chidren = listResources();
for (Resource<?> child : chidren)
{
if (child.getName().trim().equals(name))
return child;
}
return null;
}
代码示例来源:origin: org.jboss.forge.addon/shell-impl
private String getFormattedList(List<Resource> resources, int termHeight, int termWidth)
{
List<String> display = new ArrayList<>();
for (Resource resource : resources)
{
display.add(resource.getName());
}
return Parser.formatDisplayList(display, termHeight, termWidth);
}
}
代码示例来源:origin: io.fabric8.forge/fabric8-forge-core
public File getInitialSelectionFile() {
if (selection != null) {
String fullyQualifiedName = selection.getFullyQualifiedName();
if (fullyQualifiedName != null) {
return new File(fullyQualifiedName);
}
String name = selection.getName();
if (name != null) {
return new File(name);
}
}
return null;
}
代码示例来源:origin: org.jboss.forge/forge-service-core
public File getInitialSelectionFile()
{
if (selection != null)
{
String fullyQualifiedName = selection.getFullyQualifiedName();
if (fullyQualifiedName != null)
{
return new File(fullyQualifiedName);
}
String name = selection.getName();
if (name != null)
{
return new File(name);
}
}
return null;
}
}
代码示例来源:origin: io.fabric8.forge/rest-core
public File getInitialSelectionFile() {
if (selection != null) {
String fullyQualifiedName = selection.getFullyQualifiedName();
if (fullyQualifiedName != null) {
return new File(fullyQualifiedName);
}
System.out.println("==== no fully qualified name!");
String name = selection.getName();
if (name != null) {
return new File(name);
}
System.out.println("=========== Resource has no name! " + selection);
} else {
System.out.println("============ no selection!");
}
return null;
}
代码示例来源:origin: org.jboss.forge.addon/git-impl
private List<String> listGitignores(DirectoryResource dir)
{
List<String> result = new LinkedList<>();
ResourceFilter filter = new ResourceFilter()
{
@Override
public boolean accept(Resource<?> resource)
{
return resource.getName().endsWith(GITIGNORE);
}
};
for (Resource<?> resource : dir.listResources(filter))
{
String name = resource.getName();
String cut = name.substring(0, name.indexOf(GITIGNORE));
result.add(cut);
}
return result;
}
代码示例来源:origin: org.jboss.forge.addon/shell-impl
private FileResource<?> resolveFirstResource(Resource<?> resource, final String target)
{
if (!isFile(resource) || !isDirectory(resource))
{
throw new RuntimeException(resource.getName() + " isn't a folder or file");
}
List<Resource<?>> results = resource.resolveChildren(target);
if (results.size() > 1)
{
throw new RuntimeException("ambiguous target file name: " + target);
}
if (results.isEmpty())
{
throw new RuntimeException("no resources found under path: " + target);
}
return results.get(0).reify(FileResource.class);
}
代码示例来源:origin: org.jboss.forge.addon/resources-api
Pattern matchPattern = Pattern.compile(regex);
if (matchPattern.matcher(res.getName()).matches())
代码示例来源:origin: org.jboss.forge.addon/shell-impl
for (char c : currentResource.getName().toCharArray())
prompt.add(new TerminalCharacter('[', new TerminalColor(Color.BLUE, Color.DEFAULT),
CharacterType.BOLD));
for (char c : currentResource.getName().toCharArray())
代码示例来源:origin: org.jboss.forge.addon/resources-api
if (p.matcher(child.getName()).matches())
if (child.getName().startsWith("."))
代码示例来源:origin: org.jboss.forge.addon/shell-impl
if (!resourceList.isEmpty() && !resourceList.get(0).exists())
result = Results.fail(resourceList.get(0).getName() + ": No such file or directory");
代码示例来源:origin: org.jboss.forge.addon/scaffold-faces
outcomeTargetLink.putAttribute("outcome", outcome + "/" + resource.getName() + "/search");
outcomeTargetLink.setValue(StringUtils.uncamelCase(resource.getName()));
context.put("appName", StringUtils.uncamelCase(this.project.getRoot().getName()));
context.put("navigation", writer.toString().trim());
context.put("targetDir", targetDir);
代码示例来源:origin: org.jboss.forge.addon/shell-impl
private void copy(final Resource<?> source, Resource<?> directory, final String target)
{
Resource<?> targetResource = resolveFirstResource(directory, target);
if (targetResource.exists())
{
if (isDirectory(targetResource))
{
targetResource = targetResource.getChild(source.getName());
}
}
((WriteableResource) targetResource).setContents(source.getResourceInputStream());
}
代码示例来源:origin: org.jboss.forge.addon/shell-impl
output.err().println("cat: " + resource.getName() + ": No such file or directory");
result = Results.fail();
highlighter.byFileName(resource.getName(), resource.getContents(), output.out());
output.out().println();
output.err().println("cat: " + resource.getName() + ": " + uoe.getMessage());
result = Results.fail();
代码示例来源:origin: org.jboss.forge.addon/shell-impl
.getName());
newTargetDir = ((DirectoryResource) targetResource).getOrCreateChildDirectory(source.getName());
Resource<?> child = targetResource.getChild(source.getName());
((DirectoryResource) targetResource).getOrCreateChildDirectory(source.getName()).setContents(
source.getResourceInputStream());
代码示例来源:origin: org.jboss.forge.addon/scaffold-faces
context.addValidationError(pageTemplate, "The template [" + template.getName()
+ "] does not exist. You must select a template that exists.");
代码示例来源:origin: org.jboss.forge.addon/shell-impl
"rm: cannot remove '" + resource.getName()
+ "': Is a directory ");
"rm: directory '" + resource.getName()
+ "' not empty and cannot be deleted without '--force' '-f' option.");
代码示例来源:origin: org.jboss.forge.addon/resources-impl
add(name + File.separatorChar + child.getName(), child);
内容来源于网络,如有侵权,请联系作者删除!