com.gwtplatform.dispatch.rest.rebind.action.Action.vm Maven / Gradle / Ivy
The newest version!
package $package;
import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.core.HttpHeaders;
import com.gwtplatform.dispatch.rest.client.codegen.AbstractRestAction;
import com.gwtplatform.dispatch.rest.client.core.parameters.HttpParameterFactory;
import com.gwtplatform.dispatch.rest.shared.ContentType;
import com.gwtplatform.dispatch.rest.shared.HttpMethod;
import com.gwtplatform.dispatch.rest.shared.HttpParameter.Type;
public class $impl extends AbstractRestAction<$result> {
public ${impl}(
HttpParameterFactory httpParameterFactory,
String defaultDateFormat#generateAppendedMethodSignature($parameters)) {
super(httpParameterFactory, defaultDateFormat, HttpMethod.$httpVerb, "$path");
#foreach($param in $httpParameters)
addParam(Type.$param.type.getAssociatedType(), "$param.name", $param.variableName#if($param.dateFormat), "$param.dateFormat"#end);
#end
#if($bodyParameterName)
setBodyParam($bodyParameterName);
#end
}
@Override
public boolean isSecured() {
return $secured;
}
@Override
public String getBodyClass() {
return #if($body)"$body"#{else}null#end;
}
@Override
public String getResultClass() {
return "$result";
}
@Override
public List getClientProducedContentTypes() {
List contentTypes = new ArrayList();
#foreach($consume in $consumes)
contentTypes.add(#recreateContentType($consume));
#end
return contentTypes;
}
@Override
public List getClientConsumedContentTypes() {
List contentTypes = new ArrayList();
#foreach($produce in $produces)
contentTypes.add(#recreateContentType($produce));
#end
return contentTypes;
}
}