Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,10 @@

import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.Element;
import javax.lang.model.element.ExecutableElement;

import org.androidannotations.annotations.rest.Delete;
import org.androidannotations.processing.EBeanHolder;

import com.sun.codemodel.JCodeModel;

public class DeleteProcessor extends MethodProcessor {
public class DeleteProcessor extends GetPostProcessor {

public DeleteProcessor(ProcessingEnvironment processingEnv, RestImplementationsHolder restImplementationsHolder) {
super(processingEnv, restImplementationsHolder);
Expand All @@ -36,14 +32,9 @@ public String getTarget() {
}

@Override
public void process(Element element, JCodeModel codeModel, EBeanHolder holder) throws Exception {

ExecutableElement executableElement = (ExecutableElement) element;

Delete deleteAnnotation = element.getAnnotation(Delete.class);
String urlSuffix = deleteAnnotation.value();

generateRestTemplateCallBlock(new MethodProcessorHolder(holder, executableElement, urlSuffix, null, null, codeModel));
public String retrieveUrlSuffix(Element element) {
Delete getAnnotation = element.getAnnotation(Delete.class);
return getAnnotation.value();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,10 @@

import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.Element;
import javax.lang.model.element.ExecutableElement;

import org.androidannotations.annotations.rest.Put;
import org.androidannotations.processing.EBeanHolder;

import com.sun.codemodel.JCodeModel;
import com.sun.codemodel.JInvocation;

public class PutProcessor extends MethodProcessor {
public class PutProcessor extends GetPostProcessor {

public PutProcessor(ProcessingEnvironment processingEnv, RestImplementationsHolder restImplementationsHolder) {
super(processingEnv, restImplementationsHolder);
Expand All @@ -37,19 +32,9 @@ public String getTarget() {
}

@Override
public void process(Element element, JCodeModel codeModel, EBeanHolder holder) throws Exception {

ExecutableElement executableElement = (ExecutableElement) element;

Put putAnnotation = element.getAnnotation(Put.class);
String urlSuffix = putAnnotation.value();

generateRestTemplateCallBlock(new MethodProcessorHolder(holder, executableElement, urlSuffix, null, null, codeModel));
}

@Override
protected JInvocation addHttpEntityVar(JInvocation restCall, MethodProcessorHolder methodHolder) {
return restCall.arg(generateHttpEntityVar(methodHolder));
public String retrieveUrlSuffix(Element element) {
Put getAnnotation = element.getAnnotation(Put.class);
return getAnnotation.value();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ public boolean validate(Element element, AnnotationElements validatedElements) {

validatorHelper.throwsOnlyRestClientException(executableElement, valid);

validatorHelper.returnTypeIsVoid(executableElement, valid);
validatorHelper.doesNotReturnPrimitive(executableElement, valid);

restAnnotationHelper.urlVariableNamesExistInParametersAndHasNoOneMoreParameter(executableElement, valid);
restAnnotationHelper.urlVariableNamesExistInParametersAndHasOnlyOneMoreParameter(executableElement, valid);

return valid.isValid();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public boolean validate(Element element, AnnotationElements validatedElements) {

validatorHelper.throwsOnlyRestClientException(executableElement, valid);

validatorHelper.returnTypeIsVoid(executableElement, valid);
validatorHelper.doesNotReturnPrimitive(executableElement, valid);

restAnnotationHelper.urlVariableNamesExistInParametersAndHasOnlyOneMoreParameter(executableElement, valid);

Expand Down