当前位置: 首页>>代码示例>>Java>>正文


Java Resource.getParentResource方法代码示例

本文整理汇总了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;
}
 
开发者ID:pagesjaunes,项目名称:raml-codegen,代码行数:18,代码来源:ActionAdaptator.java

示例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;
}
 
开发者ID:aureliano,项目名称:cgraml-maven-plugin,代码行数:17,代码来源:RamlHelper.java

示例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;
}
 
开发者ID:pagesjaunes,项目名称:raml-codegen,代码行数:12,代码来源:ActionAdaptator.java

示例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);
}
 
开发者ID:pagesjaunes,项目名称:raml-codegen,代码行数:36,代码来源:ResourceAdaptator.java

示例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);
    }
}
 
开发者ID:nidi3,项目名称:raml-doc,代码行数:7,代码来源:ResourceAdaptor.java


注:本文中的org.raml.model.Resource.getParentResource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。