Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
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 @@ -55,6 +55,7 @@
import org.androidannotations.rest.spring.annotations.Head;
import org.androidannotations.rest.spring.annotations.Options;
import org.androidannotations.rest.spring.annotations.Part;
import org.androidannotations.rest.spring.annotations.Patch;
import org.androidannotations.rest.spring.annotations.Path;
import org.androidannotations.rest.spring.annotations.Post;
import org.androidannotations.rest.spring.annotations.Put;
Expand All @@ -68,7 +69,7 @@ public class RestSpringValidatorHelper extends ValidatorHelper {

private static final List<String> VALID_REST_INTERFACES = asList(RestClientHeaders.class.getName(), RestClientErrorHandling.class.getName(),
RestClientRootUrl.class.getName(), RestClientSupport.class.getName());
private static final List<Class<? extends Annotation>> REST_ANNOTATION_CLASSES = Arrays.asList(Get.class, Head.class, Options.class, Post.class, Put.class, Delete.class);
private static final List<Class<? extends Annotation>> REST_ANNOTATION_CLASSES = Arrays.asList(Get.class, Head.class, Options.class, Post.class, Put.class, Patch.class, Delete.class);

private static final String METHOD_NAME_SET_ROOT_URL = "setRootUrl";
private static final String METHOD_NAME_SET_AUTHENTICATION = "setAuthentication";
Expand Down Expand Up @@ -569,7 +570,7 @@ public void elementHasOneOfRestMethodAnnotations(Element element, ElementValidat
}

public void usesSpringAndroid2(Element element, ElementValidation validation) {
if (environment().getProcessingEnvironment().getElementUtils().getTypeElement(RestSpringClasses.PARAMETERIZED_TYPE_REFERENCE) != null) {
if (environment().getProcessingEnvironment().getElementUtils().getTypeElement(RestSpringClasses.PARAMETERIZED_TYPE_REFERENCE) == null) {
validation.addError(element, "To use %s annotated method you must add Spring Android Rest Template 2.0 to your classpath");
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Copyright (C) 2010-2015 eBusiness Information, Excilys Group
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed To in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.androidannotations.rest.spring;


import org.androidannotations.rest.spring.annotations.Patch;
import org.androidannotations.rest.spring.annotations.Rest;
import org.springframework.http.converter.StringHttpMessageConverter;

@Rest(converters = StringHttpMessageConverter.class)
public interface ClientWithPatch {

@Patch("/")
void patchMethod(String entity);
}
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,12 @@ public void clientWithAllInterfaces() throws IOException {
CompileResult result = compileFiles(ClientWithAllInterfaces.class);
assertCompilationSuccessful(result);
}

@Test
public void patchWithoutSpring2DoesNotCompile() throws IOException {
CompileResult result = compileFiles(ClientWithPatch.class);

assertCompilationErrorOn(ClientWithPatch.class, "@Patch(\"/\")", result);
assertCompilationErrorCount(1, result);
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.