本文整理了Java中org.apache.sling.api.resource.Resource.getName
方法的一些代码示例,展示了Resource.getName
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Resource.getName
方法的具体详情如下:
包路径:org.apache.sling.api.resource.Resource
类名称:Resource
方法名:getName
[英]Returns the name of this resource. The name of a resource is the last segment of the #getPath().
[中]返回此资源的名称。资源的名称是#getPath()的最后一段。
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
@Override
public int compare(final Resource o1, final Resource o2) {
return o1.getName().compareTo(o2.getName().toString());
}
}
代码示例来源:origin: org.apache.sling/org.apache.sling.cms.core
public String getTitle() {
if (StringUtils.isNotEmpty(title)) {
return title;
} else {
return resource.getName();
}
}
代码示例来源:origin: io.wcm/io.wcm.caconfig.extensions
@Override
public Object transform(Object input) {
Resource item = (Resource)input;
return getResourceInheritanceChainInternal(bucketNames, configName + "/" + item.getName(), paths.iterator(), resourceResolver);
}
});
代码示例来源:origin: org.apache.sling/org.apache.sling.fsresource
@Override
public boolean evaluate(Object object) {
Resource resource = (Resource)object;
return names.add(resource.getName());
}
});
代码示例来源:origin: org.apache.sling/org.apache.sling.servlets.post
private Resource seek() {
Resource result = null;
while ( iter.hasNext() && result == null ) {
final Resource c = iter.next();
if ( c.getName().startsWith(prefix) ) {
result = c;
}
}
return result;
}
代码示例来源:origin: adobe/aem-core-wcm-components
@Override
public Iterable<Resource> filterChildResources(Iterable<Resource> childResources) {
return StreamSupport
.stream(childResources.spliterator(), false)
.filter(r -> !IGNORED_NODE_NAMES.contains(r.getName()))
.collect(Collectors.toList());
}
}
代码示例来源:origin: org.apache.sling/org.apache.sling.api
/**
* Returns the value of calling <code>getName</code> on the
* {@link #getResource() wrapped resource}.
*
* @since 2.1.0 (Sling API Bundle 2.1.0)
*/
@Override
public String getName() {
return getResource().getName();
}
代码示例来源:origin: org.apache.sling/org.apache.sling.pipes
/**
* Update all the static bindings related to a given resource
* @param name name under which static bindings should be recorded
* @param resource resource from which static bindings will be built
*/
public void updateStaticBindings(String name, Resource resource){
if (resource != null) {
pathBindings.put(name, resource.getPath());
nameBindings.put(name, resource.getName());
}
}
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
PageCompareDataLineImpl(Resource resource, String basePath, int depth) {
this.path = resource.getPath().replace(basePath, "");
this.name = resource.getName();
this.value = null;
this.depth = depth;
}
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
@PostConstruct
protected void setValues() {
id = resource.getName();
path = resource.getPath();
}
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
public Resource getChildNamed(String name) {
for (Resource child : getChildren()) {
if (child.getName().equals(name)) {
return child;
}
}
return null;
}
代码示例来源:origin: adobe/aem-core-wcm-components
protected Map<String, ComponentExporter> getItemModels(@Nonnull SlingHttpServletRequest request,
@Nonnull Class<ComponentExporter> modelClass) {
Map<String, ComponentExporter> models = new LinkedHashMap<>();
getFilteredChildren().forEach(child -> {
ComponentExporter model = modelFactory.getModelFromWrappedRequest(request, child, modelClass);
if (model != null) {
models.put(child.getName(), model);
}
});
return models;
}
}
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
public CurrentEvolutionEntryImpl(Resource resource, EvolutionConfig config) {
this.config = config;
this.type = EvolutionEntryType.RESOURCE;
this.name = resource.getName();
this.depth = EvolutionPathUtil.getLastDepthForPath(resource.getPath());
this.path = resource.getParent().getName();
this.value = null;
}
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
private int getResourceIndex(final Resource resource) {
final String resourceName = resource.getName();
if (!StringUtils.startsWith(resourceName, LONG_FORM_TEXT_PAR)) {
return -1;
}
final String indexStr = StringUtils.removeStart(resourceName, LONG_FORM_TEXT_PAR);
try {
return Integer.parseInt(indexStr);
} catch (NumberFormatException ex) {
return -1;
}
}
代码示例来源:origin: com.adobe.acs/acs-aem-commons-bundle
private int getResourceIndex(final Resource resource) {
final String resourceName = resource.getName();
if (!StringUtils.startsWith(resourceName, LONG_FORM_TEXT_PAR)) {
return -1;
}
final String indexStr = StringUtils.removeStart(resourceName, LONG_FORM_TEXT_PAR);
try {
return Integer.parseInt(indexStr);
} catch (NumberFormatException ex) {
return -1;
}
}
代码示例来源:origin: adobe/aem-core-wcm-components
private <T> Map<String, T> getChildrenModels(@Nonnull SlingHttpServletRequest request, @Nonnull Class<T>
modelClass) {
Map<String, T> models = new LinkedHashMap<>();
for (Resource child : slingModelFilter.filterChildResources(resource.getChildren())) {
T model = modelFactory.getModelFromWrappedRequest(request, child, modelClass);
if (model != null) {
models.put(child.getName(), model);
}
}
return models;
}
}
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
public List<Rendition> getRenditions(Asset asset) {
Resource renditions = frozenResource.getChild(RENDITIONS_PATH);
if (renditions == null) {
return Lists.newArrayList();
}
List<Rendition> rv = Lists.newArrayList();
for (Resource r : renditions.getChildren()) {
rv.add(getRendition(asset, r.getName()));
}
return rv;
}
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
public EvolutionEntryImpl(Resource resource, Version version, EvolutionConfig config) {
this.config = config;
this.type = EvolutionEntryType.RESOURCE;
this.name = resource.getName();
this.depth = EvolutionPathUtil.getDepthForPath(resource.getPath());
this.path = resource.getParent().getName();
this.version = version;
this.value = null;
this.relativePath = EvolutionPathUtil.getRelativeResourceName(resource.getPath());
}
代码示例来源:origin: com.adobe.acs/acs-aem-commons-bundle
public EvolutionEntryImpl(Resource resource, Version version, EvolutionConfig config) {
this.config = config;
this.type = EvolutionEntryType.RESOURCE;
this.name = resource.getName();
this.depth = config.getDepthForPath(resource.getPath());
this.path = resource.getParent().getName();
this.version = version;
this.value = null;
this.relativePath = config.getRelativeResourceName(resource.getPath());
}
代码示例来源:origin: org.apache.sling/org.apache.sling.resourceresolver
private void copy(final ResourceResolverContext context, final Resource src, final String dstPath, final List<Resource> newNodes) throws PersistenceException {
final ValueMap vm = src.getValueMap();
final String createPath = new PathBuilder(dstPath).append(src.getName()).toString();
newNodes.add(this.create(context, createPath, vm));
for(final Resource c : src.getChildren()) {
copy(context, c, createPath, newNodes);
}
}
内容来源于网络,如有侵权,请联系作者删除!