functions.RESTResource.ext Maven / Gradle / Ivy
extension java::GeneratorCommons;
extension functions::RESTOperation;
extension jeaf::RESTFunctions;
extension jeaf::RESTFunctions;
extension java::Naming;
cached boolean isRESTResource(uml::Element element):
element.isStereotypeApplied("RESTResource");
cached JMM::RESTResource asRESTResource(uml::Element element):
(JMM::RESTResource) element;
cached boolean filterCustomHeaders(JMM::RESTResource resource):
filterCustomHeaders() && resource.ownedOperation.typeSelect(JMM::RESTOperation).select(e|e.hasBeanParamsForRESTOperation()).getBeanParamsForRESTOperation().select(e|e.supportsCustomHeaders).isEmpty == false;
cached String getResourceName(JMM::RESTResource resource, boolean reactive):
if reactive
then resource.name + "ReactiveResource"
else resource.name + "Resource";
cached String asRESTParameterListNames(uml::Operation operation, boolean reactive) :
if reactive == false
then operation.asParameterListNames()
else
operation.getInputParameters().select(e|e.isParameterSuppressed() == false).getReactiveParameterName().toString(", ");
private String getReactiveParameterName(uml::Parameter parameter):
if parameter.isRequestBody()
then parameter.name + "Body"
else parameter.name;