All Downloads are FREE. Search and download functionalities are using the official Maven repository.

functions.RESTResource.ext Maven / Gradle / Ivy

There is a newer version: 1.24.1
Show newest version
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;
    




© 2015 - 2024 Weber Informatics LLC | Privacy Policy