本文整理汇总了Java中org.raml.model.Resource.getParentResource方法的典型用法代码示例。如果您正苦于以下问题:Java Resource.getParentResource方法的具体用法?Java Resource.getParentResource怎么用?Java Resource.getParentResource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.raml.model.Resource
的用法示例。
在下文中一共展示了Resource.getParentResource方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildTemplate
import org.raml.model.Resource; //导入方法依赖的package包/类
private String buildTemplate() {
Resource oResource=action.getResource();
String oUrl=oResource.getRelativeUri();
while(oResource.getParentResource()!=null) {
oResource=oResource.getParentResource();
oUrl=oResource.getRelativeUri()+oUrl;
}
if(!Utils.hasBeenResolved(root.getBaseUri())) {
oUrl=root.getBaseUri()+oUrl;
}
oResource=action.getResource();
while(oResource!=null) {
oUrl=Resolver.resolve(oUrl, oResource.getUriParameters(), "[UriParameter]");
oResource=oResource.getParentResource();
}
return oUrl;
}
示例2: getResourcePaths
import org.raml.model.Resource; //导入方法依赖的package包/类
private static List<String> getResourcePaths(Resource resource) {
List<String> paths = new ArrayList<String>();
String uri = resource.getUri();
Resource parent = resource.getParentResource();
if (parent != null) {
for (String path : getResourcePaths(parent)) {
paths.add(path);
}
uri = uri.replace(parent.getUri(), "");
}
paths.add(uri);
return paths;
}
示例3: resolve
import org.raml.model.Resource; //导入方法依赖的package包/类
private String resolve(String aUrl) {
Resource oResource=action.getResource();
while(oResource!=null) {
aUrl=Resolver.resolve(aUrl, Resolver.fromBaseToUri(oResource.getBaseUriParameters()), "[BaseUriParameter]");
oResource=oResource.getParentResource();
}
if(root.getVersion()!=null) {
aUrl=Utils.resolve(aUrl, "version", root.getVersion());
}
return aUrl;
}
示例4: getProperty
import org.raml.model.Resource; //导入方法依赖的package包/类
@Override
public synchronized Object getProperty(Interpreter anInter, ST aSt,
Object anObject, Object aProperty, String aName)
throws STNoSuchPropertyException {
Resource oResource=(Resource)anObject;
if(aName.startsWith("uri")) {
String oUri = oResource.getParentResource()==null?"":(String)getProperty(anInter, aSt, oResource.getParentResource(), aName, aName);
oUri += oResource.getRelativeUri();
if(aName.endsWith("express")) {
oUri=StringUtils.replace(oUri, "{mediaTypeExtension}", "");
oUri=StringUtils.replace(StringUtils.replaceChars(oUri, '{', ':'),"}", "");
}
return oUri;
}
if(aName.equals("methodUri")) {
String oReturn=Utils.cleanString(oResource.getRelativeUri());
for(Resource oR=oResource.getParentResource(); oR!=null; oR=oR.getParentResource()) {
oReturn=Utils.cleanString(oR.getRelativeUri())+"_"+oReturn;
}
return oReturn;
}
if(aName.equals("get")) {
return oResource.getAction(ActionType.GET);
}
if(aName.equals("post")) {
return oResource.getAction(ActionType.POST);
}
if(aName.equals("put")) {
return oResource.getAction(ActionType.PUT);
}
if(aName.equals("delete")) {
return oResource.getAction(ActionType.DELETE);
}
return super.getProperty(anInter, aSt, anObject, aProperty, aName);
}
示例5: getAllResources
import org.raml.model.Resource; //导入方法依赖的package包/类
public void getAllResources(Resource resource, Map<String, UriParameter> res) {
res.putAll(resource.getUriParameters());
if (resource.getParentResource() != null) {
getAllResources(resource.getParentResource(), res);
}
}