本文整理汇总了Java中org.raml.model.parameter.UriParameter类的典型用法代码示例。如果您正苦于以下问题:Java UriParameter类的具体用法?Java UriParameter怎么用?Java UriParameter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UriParameter类属于org.raml.model.parameter包,在下文中一共展示了UriParameter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: generate
import org.raml.model.parameter.UriParameter; //导入依赖的package包/类
public void generate() {
if (resource.getParentResource() != null && !resource.getParentResource().getUriParameters().isEmpty()) {
Map<String, UriParameter> combined = new HashMap<>();
combined.putAll(resource.getParentResource().getUriParameters());
combined.putAll(resource.getUriParameters());
resource.setUriParameters(combined);
}
resource.getResources().values().stream().forEach(generateResourceClasses);
uri = new UriConst(resource.getUri());
apiClass = ApiResourceClass.forResource(resource)
.withField(uri)
.withField(req)
.withField(resp);
responseParser = respParserForResource(resource);
defaultsMethod = new DefaultsMethod(apiClass, req);
new ResourceRule().apply(resource, this);
javaFiles.stream().forEach(writeTo);
}
开发者ID:qameta,项目名称:rarc,代码行数:22,代码来源:ResourceClassBuilder.java
示例2: createApi
import org.raml.model.parameter.UriParameter; //导入依赖的package包/类
@Override
public String createApi(Raml raml, String name, JSONObject config) {
this.config = config;
// TODO: What to use as description?
final RestApi api = createApi(getApiName(raml, name), null);
LOG.info("Created API "+api.getId());
try {
final Resource rootResource = getRootResource(api).get();
deleteDefaultModels(api);
createModels(api, raml.getSchemas(), false);
createResources(api, createResourcePath(api, rootResource, raml.getBasePath()),
new HashMap<String, UriParameter>(), raml.getResources(), false);
} catch (Throwable t) {
LOG.error("Error creating API, rolling back", t);
rollback(api);
throw t;
}
return api.getId();
}
开发者ID:awslabs,项目名称:aws-apigateway-importer,代码行数:23,代码来源:ApiGatewaySdkRamlApiImporter.java
示例3: checkPathOnlyContainsParams
import org.raml.model.parameter.UriParameter; //导入依赖的package包/类
private boolean checkPathOnlyContainsParams(Resource childResource)
{
String uri = childResource.getRelativeUri();
// replace all params and their enclosing curly brackets with emmpty string
// also replace "/" with empty string, the remainder is the name, which can be
// an empty string if path consists entirely of uri params
uri = StringUtils.substitute(uri, "/", "");
Map<String, UriParameter> params = childResource.getUriParameters();
for (String paramName : params.keySet())
{
uri = StringUtils.substitute(uri, "{"+paramName+"}", "");
}
if (uri.trim().equals(""))
{
uri=null;
}
return uri==null;
}
开发者ID:oracle,项目名称:mobile-persistence,代码行数:19,代码来源:RAMLParser.java
示例4: addUriParameter
import org.raml.model.parameter.UriParameter; //导入依赖的package包/类
@Override
public EndpointRoute addUriParameter(String key, String description, String example) {
UriParameter param = new UriParameter(key);
param.setDescription(description);
param.setExample(example);
uriParameters.put(key, param);
return this;
}
开发者ID:gentics,项目名称:mesh,代码行数:9,代码来源:EndpointImpl.java
示例5: apply
import org.raml.model.parameter.UriParameter; //导入依赖的package包/类
@Override
public void apply(UriParameter param, ResourceClassBuilder resourceClassBuilder) {
resourceClassBuilder.getApiClass().withMethod(
new AddPathParamMethod(param, param.getDisplayName(),
resourceClassBuilder.getReq(),
resourceClassBuilder.getApiClass()));
resourceClassBuilder.getDefaultsMethod().forParamDefaults(param.getDisplayName(), param);
}
开发者ID:qameta,项目名称:rarc,代码行数:9,代码来源:UriParamRule.java
示例6: getProperty
import org.raml.model.parameter.UriParameter; //导入依赖的package包/类
@Override
public Object getProperty(Interpreter interp, ST self, Object o, Object property, String propertyName) throws STNoSuchPropertyException {
final Resource res = (Resource) o;
switch (propertyName) {
case "resolvedUriParameters":
final Map<String, UriParameter> params = new TreeMap<>();
getAllResources(res, params);
return params;
case "actions":
return new TreeMap<>(res.getActions());
default:
return super.getProperty(interp, self, o, property, propertyName);
}
}
开发者ID:nidi3,项目名称:raml-doc,代码行数:15,代码来源:ResourceAdaptor.java
示例7: updateApi
import org.raml.model.parameter.UriParameter; //导入依赖的package包/类
@Override
public void updateApi(String apiId, Raml raml, JSONObject config) {
this.config = config;
RestApi api = getApi(apiId);
Optional<Resource> rootResource = getRootResource(api);
createModels(api, raml.getSchemas(), true);
createResources(api, createResourcePath(api, rootResource.get(), raml.getBasePath()),
new HashMap<String, UriParameter>(), raml.getResources(), true);
cleanupResources(api, this.paths);
cleanupModels(api, this.models);
}
开发者ID:awslabs,项目名称:aws-apigateway-importer,代码行数:15,代码来源:ApiGatewaySdkRamlApiImporter.java
示例8: createResources
import org.raml.model.parameter.UriParameter; //导入依赖的package包/类
private void createResources(RestApi api, Resource rootResource, Map<String, UriParameter> ancestorRequestParameters,
Map<String, org.raml.model.Resource> resources, boolean update) {
for (Map.Entry<String, org.raml.model.Resource> entry : resources.entrySet()) {
final org.raml.model.Resource resource = entry.getValue();
final Resource parentResource = createResourcePath(api, rootResource, entry.getKey());
Map<String, UriParameter> requestParameters = new HashMap<String, UriParameter>(resource.getUriParameters());
requestParameters.putAll(ancestorRequestParameters);
createMethods(api, parentResource, requestParameters, resource.getActions(), update);
createResources(api, parentResource, requestParameters, resource.getResources(), update);
}
}
开发者ID:awslabs,项目名称:aws-apigateway-importer,代码行数:14,代码来源:ApiGatewaySdkRamlApiImporter.java
示例9: createMethods
import org.raml.model.parameter.UriParameter; //导入依赖的package包/类
private void createMethods(RestApi api, Resource resource, Map<String, UriParameter> requestParameters,
Map<ActionType, Action> actions, boolean update) {
for (Map.Entry<ActionType, Action> entry : actions.entrySet()) {
createMethod(api, resource, entry.getKey(), entry.getValue(), requestParameters, update);
}
if (update) {
cleanupMethods(resource, actions);
}
}
开发者ID:awslabs,项目名称:aws-apigateway-importer,代码行数:11,代码来源:ApiGatewaySdkRamlApiImporter.java
示例10: getParameters
import org.raml.model.parameter.UriParameter; //导入依赖的package包/类
@Override
protected Map<String, ? extends AbstractParam> getParameters() {
if (!expectation().hasValidResource())
return new HashMap<>();
Map<String, UriParameter> parameters = expectation().getResource().get().getResolvedUriParameters();
return parameters == null ? new HashMap<>() : parameters;
}
开发者ID:ozwolf-software,项目名称:raml-mock-server,代码行数:9,代码来源:RequestUriParametersValidator.java
示例11: isExpectationFor
import org.raml.model.parameter.UriParameter; //导入依赖的package包/类
public boolean isExpectationFor(Resource resource) {
List<String> uriValues = Arrays.asList(StringUtils.split(request.getPath().getValue(), "/"));
List<UriTemplateComponent> uriComponents = new UriTemplateParser().scan(resource.getUri());
if (uriValues.size() != uriComponents.size())
return false;
Map<UriTemplateComponent, String> componentValues = newHashMap();
for (int i = 0; i < uriComponents.size(); i++)
componentValues.put(uriComponents.get(i), uriValues.get(i));
Map<String, UriParameter> parameters = newHashMap();
resource.getResolvedUriParameters().entrySet()
.stream()
.forEach(e -> parameters.put(String.format("{%s}", e.getKey()), e.getValue()));
return componentValues.entrySet()
.stream()
.allMatch(e -> {
UriTemplateComponent component = e.getKey();
String value = e.getValue();
if (component instanceof Literal) {
return StringUtils.replace(component.getValue(), "/", "").equals(value);
} else {
return parameters.containsKey(component.getValue());
}
});
}
开发者ID:ozwolf-software,项目名称:raml-mock-server,代码行数:30,代码来源:ApiExpectation.java
示例12: uriParameter
import org.raml.model.parameter.UriParameter; //导入依赖的package包/类
private Map<String, UriParameter> uriParameter(boolean required, boolean repeatable) {
UriParameter parameter = new UriParameter();
parameter.setRequired(required);
parameter.setRepeat(repeatable);
parameter.setType(ParamType.INTEGER);
Map<String, UriParameter> parameters = new HashMap<>();
parameters.put("ttl", parameter);
return parameters;
}
开发者ID:ozwolf-software,项目名称:raml-mock-server,代码行数:10,代码来源:RequestUriParametersValidatorTest.java
示例13: fromBaseToUri
import org.raml.model.parameter.UriParameter; //导入依赖的package包/类
public static Map<String, UriParameter> fromBaseToUri(Map<String, List<UriParameter>> aMap) {
Map<String, UriParameter> oParams=new HashMap<String, UriParameter>();
for (Map.Entry<String, List<UriParameter>> oE:aMap.entrySet()) {
oParams.put(oE.getKey(), oE.getValue().get(0));
}
return oParams;
}
开发者ID:pagesjaunes,项目名称:raml-codegen,代码行数:8,代码来源:Resolver.java
示例14: extractResourceNameFromUriPath
import org.raml.model.parameter.UriParameter; //导入依赖的package包/类
private String extractResourceNameFromUriPath(Resource childResource)
{
String uri = childResource.getRelativeUri();
// replace all params and their enclosing curly brackets with emmpty string
Map<String, UriParameter> params = childResource.getUriParameters();
for (String paramName : params.keySet())
{
uri = StringUtils.substitute(uri, "{"+paramName+"}", "");
}
// find a string after a slash, starting with the last slash. Whena struing is found, this
// is the candidate bresource name
String resourceName = null;
while (uri.lastIndexOf("/")>-1)
{
int lastSlashPos = uri.lastIndexOf("/");
if (uri.length()>lastSlashPos+1)
{
resourceName = uri.substring(lastSlashPos+1);
break;
}
else if (lastSlashPos>0)
{
// reduce uri to part before this slash
uri = uri.substring(0,lastSlashPos);
}
else
{
break;
}
}
return resourceName;
}
开发者ID:oracle,项目名称:mobile-persistence,代码行数:34,代码来源:RAMLParser.java
示例15: convertUriParameterMap
import org.raml.model.parameter.UriParameter; //导入依赖的package包/类
public List<ch.alv.components.web.api.config.UriParameter> convertUriParameterMap(Map<String, UriParameter> uriParameters) {
List<ch.alv.components.web.api.config.UriParameter> list = new ArrayList<>();
for (String key : uriParameters.keySet()) {
list.add(convertUriParameter(uriParameters.get(key)));
}
return list;
}
开发者ID:alv-ch,项目名称:alv-ch-java,代码行数:8,代码来源:RamlConverter.java
示例16: convertUriParameterListMap
import org.raml.model.parameter.UriParameter; //导入依赖的package包/类
public List<ch.alv.components.web.api.config.UriParameter> convertUriParameterListMap(Map<String, List<UriParameter>> baseUriParameters) {
List<ch.alv.components.web.api.config.UriParameter> list = new ArrayList<>();
if (baseUriParameters == null || baseUriParameters.isEmpty()) {
return list;
}
for (String key : baseUriParameters.keySet()) {
List<UriParameter> sources = baseUriParameters.get(key);
for (UriParameter source : sources) {
list.add(convertUriParameter(source));
}
}
return list;
}
开发者ID:alv-ch,项目名称:alv-ch-java,代码行数:14,代码来源:RamlConverter.java
示例17: testMapParameterValues
import org.raml.model.parameter.UriParameter; //导入依赖的package包/类
@Test
public void testMapParameterValues() {
ch.alv.components.web.api.config.UriParameter target = new ch.alv.components.web.api.config.UriParameter();
converter.mapBaseParameterValues(uriParameter, target);
assertEquals(uriParameter.getDisplayName(), target.getName());
assertEquals(uriParameter.getDescription(), target.getDescription());
assertEquals(uriParameter.getPattern(), target.getPattern());
assertEquals(ParameterType.BOOLEAN, target.getType());
}
开发者ID:alv-ch,项目名称:alv-ch-java,代码行数:10,代码来源:RamlConverterTest.java
示例18: findUriParam
import org.raml.model.parameter.UriParameter; //导入依赖的package包/类
public static AbstractParam findUriParam(String uriParam, Resource resource) {
final UriParameter param = resource.getUriParameters().get(uriParam);
if (param != null) {
return param;
}
if (resource.getParentResource() != null) {
return findUriParam(uriParam, resource.getParentResource());
}
return null;
}
开发者ID:nidi3,项目名称:raml-tester,代码行数:11,代码来源:CheckerHelper.java
示例19: getEffectiveBaseUriParams
import org.raml.model.parameter.UriParameter; //导入依赖的package包/类
public static Map<String, List<? extends AbstractParam>> getEffectiveBaseUriParams(Map<String, UriParameter> baseUriParams, Action action) {
final Map<String, List<? extends AbstractParam>> params = new HashMap<>();
if (action.getBaseUriParameters() != null) {
params.putAll(action.getBaseUriParameters());
}
addNotSetBaseUriParams(action.getResource(), params);
if (baseUriParams != null) {
for (final Map.Entry<String, UriParameter> entry : baseUriParams.entrySet()) {
if (!params.containsKey(entry.getKey())) {
params.put(entry.getKey(), Collections.singletonList(entry.getValue()));
}
}
}
return params;
}
开发者ID:nidi3,项目名称:raml-tester,代码行数:16,代码来源:CheckerHelper.java
示例20: addNotSetBaseUriParams
import org.raml.model.parameter.UriParameter; //导入依赖的package包/类
private static void addNotSetBaseUriParams(Resource resource, Map<String, List<? extends AbstractParam>> params) {
if (resource.getBaseUriParameters() != null) {
for (final Map.Entry<String, List<UriParameter>> entry : resource.getBaseUriParameters().entrySet()) {
if (!params.containsKey(entry.getKey())) {
params.put(entry.getKey(), entry.getValue());
}
}
}
if (resource.getParentResource() != null) {
addNotSetBaseUriParams(resource.getParentResource(), params);
}
}
开发者ID:nidi3,项目名称:raml-tester,代码行数:13,代码来源:CheckerHelper.java
注:本文中的org.raml.model.parameter.UriParameter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论