本文整理了Java中org.raml.model.Action.getType()
方法的一些代码示例,展示了Action.getType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Action.getType()
方法的具体详情如下:
包路径:org.raml.model.Action
类名称:Action
方法名:getType
暂无
代码示例来源:origin: com.sap.cloud.yaas.rammler/rammler-core
private boolean isActionWithPayload(final Action ramlAction)
{
return ActionType.POST.equals(ramlAction.getType()) || ActionType.PUT.equals(ramlAction.getType());
}
代码示例来源:origin: com.sap.cloud.yaas.rammler/rammler-core
/**
* Returns the name of the method for getting an {@link com.sap.cloud.yaas.rammler.commons.builder.ActionBuilder},
* e.g. " {@code prepareDelete}".
*
* @param ramlAction the action for which the method name should be built
* @return the name of the method for getting the action builder
*/
public static String buildActionBuilderMethodName(final Action ramlAction)
{
if (ramlAction == null)
{
return null;
}
return "prepare" + buildName(ramlAction.getType() != null ? ramlAction.getType().toString() : "Any");
}
代码示例来源:origin: com.sap.cloud.yaas.rammler/rammler-core
/**
* Build a suitable Java type name for an {@link com.sap.cloud.yaas.rammler.commons.builder.ActionBuilder}, e.g. "
* {@code GetActionBuilder}".
*
* @param ramlAction the RAML {@link Action}
* @return a corresponding Java type name
*/
public static String buildActionBuilderName(final Action ramlAction)
{
return ramlAction != null ? buildName(ramlAction.getType().toString()) + "ActionBuilder" : null;
}
代码示例来源:origin: org.raml/raml-jaxrs-codegen-core
String type = action.getType().toString().toLowerCase();
代码示例来源:origin: mulesoft-labs/raml-jaxrs-codegen
public static String buildResourceMethodName(final Action action, final MimeType bodyMimeType)
{
final String methodBaseName = buildJavaFriendlyName(action.getResource()
.getUri()
.replace("{", " By "));
return action.getType().toString().toLowerCase() + buildMimeTypeInfix(bodyMimeType) + methodBaseName;
}
代码示例来源:origin: org.raml/raml-jaxrs-codegen-core
/**
* <p>buildResourceMethodName.</p>
*
* @param action a {@link org.raml.model.Action} object.
* @param bodyMimeType a {@link org.raml.model.MimeType} object.
* @return a {@link java.lang.String} object.
*/
public static String buildResourceMethodName(final Action action, final MimeType bodyMimeType)
{
final String methodBaseName = buildJavaFriendlyName(action.getResource()
.getUri()
.replace("{", " By "));
return action.getType().toString().toLowerCase() + buildMimeTypeInfix(bodyMimeType) + methodBaseName;
}
代码示例来源:origin: nidi3/raml-tester
private String actionString() {
return new Message("action", action.getType(), action.getResource().getUri()).toString();
}
}
代码示例来源:origin: ru.lanwen.raml/rarc-core
public ActionMethod(ReqSpecField reqFieldName, RespSpecField respFieldName, UriConst uriConst, Action action) {
this.reqFieldName = reqFieldName.name();
this.respFieldName = respFieldName.name();
this.uriConst = uriConst.name();
this.action = action;
this.httpMethod = action.getType().name().toLowerCase();
this.name = defaultIfEmpty(action.getDisplayName(), httpMethod);
}
代码示例来源:origin: stackoverflow.com
if (action.isValid())
if (action.getType() == Action.e_GoTo)
代码示例来源:origin: com.sap.cloud.yaas.rammler/rammler-core
/**
* Creates a specific constructor body.
*
* @param ramlAction an action which the body reflects
* @param codeModel the code model to access JCodeModel functionality
* @param constructorBody target block to filled in
*/
protected void createConstructorBody(final Action ramlAction, final JCodeModel codeModel, final JBlock constructorBody)
{
final JInvocation setHttpMethodInvocation = constructorBody.invoke("setHttpMethod");
final JClass httpMethodEnum = codeModel.ref(HttpMethod.class);
setHttpMethodInvocation.arg(httpMethodEnum.staticRef(ramlAction.getType().toString()));
}
代码示例来源:origin: nidi3/raml-tester
static Usage.Action actionUsage(Usage usage, Action action) {
return usage.resource(action.getResource().getUri()).action(action.getType().name());
}
代码示例来源:origin: guru.nidi.raml/raml-doc-client
@Override
public Object getProperty(Interpreter interp, ST self, Object o, Object property, String propertyName) throws STNoSuchPropertyException {
final Action a = (Action) o;
switch (propertyName) {
case "securitySchemes":
if (a.getSecuredBy() != null && !a.getSecuredBy().isEmpty()) {
return a.getSecuredBy();
}
if (a.getResource().getSecuredBy() != null && !a.getResource().getSecuredBy().isEmpty()) {
return a.getResource().getSecuredBy();
}
if (raml.getSecuredBy() != null && !raml.getSecuredBy().isEmpty()) {
return raml.getSecuredBy();
}
return Collections.emptyList();
case "type":
return a.getType().toString();
case "responses":
return new TreeMap<>(a.getResponses());
case "queryParameters":
return new TreeMap<>(a.getQueryParameters());
case "headers":
return new TreeMap<>(a.getHeaders());
case "body":
return a.getBody() == null ? null : new TreeMap<>(a.getBody());
default:
return super.getProperty(interp, self, o, property, propertyName);
}
}
}
代码示例来源:origin: com.sap.cloud.yaas.rammler/rammler-core
/**
* {@inheritDoc}
* <p/>
* This implementation adds accessor methods to the {@code builderForParent} class. These accessor methods create a
* new instane of the procreated {@code builder} based on the state of the {@code builderForParent}. The name of the
* accessor method will be based on the HTTP method that is declared in the {@code ramlAction}.
*/
@Override
protected void createHooksInParentBuilder(
final Action ramlAction,
final JDefinedClass builderForParent,
final JDefinedClass builder,
final Context<Object, JDeclaration> context
)
{
final String hookMethodName = JavaNameUtils.buildActionBuilderMethodName(ramlAction);
final JMethod hookMethod = builderForParent.method(JMod.PUBLIC, builder, hookMethodName);
final JBlock hookMethodBody = hookMethod.body();
hookMethodBody._return(JExpr._new(builder).arg(JExpr.invoke("getTarget")).arg(JExpr.invoke("getRequestParams")));
// attach the Javadoc
hookMethod.javadoc().append(JavaDocs.METHOD_PREPARE_ACTION.fillTemplate(ActionBuilder.class.getCanonicalName(),
ramlAction.getType() != null ? ramlAction.getType() : "any",
builder.name()));
}
代码示例来源:origin: org.raml/raml-jaxrs-codegen-core
final JMethod method = context.createResourceMethod(resourceInterface,
methodName, resourceMethodReturnType);
context.addHttpMethodAnnotation(action.getType().toString(), method);
addParamAnnotation(resourceInterfacePath, action, method);
addConsumesAnnotation(bodyMimeType, method);
代码示例来源:origin: com.sap.cloud.yaas.service-generator/service-generator-model-raml
.methodType(TransformUtils.transform(source.getType()))//
.qualifier(buildResourceMethodName(source, parents, TransformUtils.transform(source.getType()), null))//
代码示例来源:origin: org.raml/raml-jaxrs-codegen-core
context.addHttpMethodAnnotation(action.getType().toString(), method);
代码示例来源:origin: mulesoft-labs/raml-jaxrs-codegen
protected void addResourceMethod(final JDefinedClass resourceInterface,
final String resourceInterfacePath,
final Action action,
final MimeType bodyMimeType,
final boolean addBodyMimeTypeInMethodName,
final Collection<MimeType> uniqueResponseMimeTypes) throws Exception
{
final String methodName = Names.buildResourceMethodName(action,
addBodyMimeTypeInMethodName ? bodyMimeType : null);
final JType resourceMethodReturnType = getResourceMethodReturnType(methodName, action,
uniqueResponseMimeTypes.isEmpty(), resourceInterface);
// the actually created unique method name should be needed in the previous method but
// no way of doing this :(
final JMethod method = context.createResourceMethod(resourceInterface, methodName,
resourceMethodReturnType);
Configuration contiguration = context.getConfiguration();
if (contiguration.getMethodThrowException() != null ) {
method._throws(contiguration.getMethodThrowException());
}
context.addHttpMethodAnnotation(action.getType().toString(), method);
addParamAnnotation(resourceInterfacePath, action, method);
addConsumesAnnotation(bodyMimeType, method);
addProducesAnnotation(uniqueResponseMimeTypes, method);
final JDocComment javadoc = addBaseJavaDoc(action, method);
addPathParameters(action, method, javadoc);
addHeaderParameters(action, method, javadoc);
addQueryParameters(action, method, javadoc);
addBodyParameters(bodyMimeType, method, javadoc);
}
代码示例来源:origin: com.sap.cloud.yaas.rammler/rammler-core
.append(
JavaDocs.TOP_CLASS.fillTemplate(builder.name(), ActionBuilder.class.getCanonicalName(),
ramlAction.getType()));
内容来源于网络,如有侵权,请联系作者删除!