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

com.gwtplatform.dispatch.rest.rebind.RestService.vm Maven / Gradle / Ivy

There is a newer version: 1.6
Show newest version
#macro(generateMethodSignatureFromParameters $parameters)
#foreach ($param in $parameters)

            $param.type.getParameterizedQualifiedSourceName() $param.name#commaIfNeeded($parameters)#end
#end
#macro(generateArgumentsFromParameters $parameters)
#foreach ($param in $parameters),
                $param.name#end
#end
package $package;

#if($injectable)
import javax.inject.Inject;

#end
import com.gwtplatform.dispatch.rest.client.DefaultDateFormat;
import com.gwtplatform.dispatch.rest.shared.HttpMethod;
import com.gwtplatform.dispatch.rest.shared.RestAction;
import $serviceInterface.qualifiedSourceName;
#importResources($serviceBindings)
#importResources($actionBindings)

public class $implName implements $serviceInterface.name {
#set($argumentsFromService = "")
#set($ctorDef = "")
#set($ctorAssignments = "")
#foreach ($param in $ctorParams)
    #set($argumentsFromService = "$argumentsFromService$param.name#commaIfNeeded($ctorParams)")
    #set($ctorDef = "$ctorDef,
            $param.type.getParameterizedQualifiedSourceName() $param.name")
    #set($ctorAssignments = "$ctorAssignments
        this.$param.name = $param.name;")
    private final $param.type.getParameterizedQualifiedSourceName() $param.name;
#end
    private final String defaultDateFormat;

#if($injectable)
    @Inject
#end
    public ${implName}(
            @DefaultDateFormat String defaultDateFormat$ctorDef) {
        this.defaultDateFormat = defaultDateFormat;$ctorAssignments
    }

#foreach ($action in $actionBindings)
    #set($methodParams = $action.getCtorParameters())
    #set($methodParams = $methodParams.subList($ctorParams.size(), $methodParams.size()))
    #set($methodSignature = "#generateMethodSignatureFromParameters($methodParams)")
    #set($actionArguments = "#generateArgumentsFromParameters($action.ctorParameters)")
    @Override
    public RestAction<$action.resultClass> ${action.methodName}($methodSignature) {
        return new ${action.implName}(
                defaultDateFormat$actionArguments);
    }

#end
#foreach ($service in $serviceBindings)
    #set($methodParams = $service.getCtorParameters())
    #set($methodParams = $methodParams.subList($ctorParams.size(), $methodParams.size()))
    #set($methodSignature = "#generateMethodSignatureFromParameters($methodParams)")
    #set($serviceArguments = "#generateArgumentsFromParameters($service.ctorParameters)")
    @Override
    public $service.serviceInterface ${service.methodName}($methodSignature) {
        return new ${service.implName}(
                defaultDateFormat$serviceArguments);
    }

#end
}






© 2015 - 2024 Weber Informatics LLC | Privacy Policy