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 @@ -549,14 +549,14 @@ private ModelProcessor buildModelProcessor(IRClass rClass, AndroidSystemServices
modelProcessor.register(new ExtraProcessor(processingEnv));
modelProcessor.register(new FragmentArgProcessor(processingEnv));
modelProcessor.register(new SystemServiceProcessor(androidSystemServices));
RestImplementationsHolder restImplementationHolder = new RestImplementationsHolder();
modelProcessor.register(new RestProcessor(processingEnv, restImplementationHolder));
modelProcessor.register(new GetProcessor(processingEnv, restImplementationHolder));
modelProcessor.register(new PostProcessor(processingEnv, restImplementationHolder));
modelProcessor.register(new PutProcessor(processingEnv, restImplementationHolder));
modelProcessor.register(new DeleteProcessor(processingEnv, restImplementationHolder));
modelProcessor.register(new HeadProcessor(processingEnv, restImplementationHolder));
modelProcessor.register(new OptionsProcessor(processingEnv, restImplementationHolder));
RestImplementationsHolder restImplementationsHolder = new RestImplementationsHolder();
modelProcessor.register(new RestProcessor(processingEnv, restImplementationsHolder));
modelProcessor.register(new GetProcessor(processingEnv, restImplementationsHolder));
modelProcessor.register(new PostProcessor(processingEnv, restImplementationsHolder));
modelProcessor.register(new PutProcessor(processingEnv, restImplementationsHolder));
modelProcessor.register(new DeleteProcessor(processingEnv, restImplementationsHolder));
modelProcessor.register(new HeadProcessor(processingEnv, restImplementationsHolder));
modelProcessor.register(new OptionsProcessor(processingEnv, restImplementationsHolder));
modelProcessor.register(new AppProcessor());
modelProcessor.register(new OptionsMenuProcessor(processingEnv, rClass));
modelProcessor.register(new OptionsItemProcessor(processingEnv, rClass));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@
import javax.lang.model.type.ArrayType;
import javax.lang.model.type.DeclaredType;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.type.WildcardType;

import org.androidannotations.processing.EBeanHolder;
import org.androidannotations.processing.EBeansHolder.Classes;

import com.sun.codemodel.JBlock;
import com.sun.codemodel.JCatchBlock;
import com.sun.codemodel.JClass;
Expand Down Expand Up @@ -78,6 +80,16 @@ public JClass typeMirrorToJClass(TypeMirror type, EBeanHolder holder) {
}

return declaredClass;
} else if (type instanceof WildcardType) {
// TODO : At his time (01/2013), it is not possible to handle the
// super bound because code model does not offer a way to model
// statement like " ? super X"
// (see http://java.net/jira/browse/CODEMODEL-11)
WildcardType wildcardType = (WildcardType) type;

TypeMirror extendsBound = wildcardType.getExtendsBound();

return typeMirrorToJClass(extendsBound, holder).wildcard();
} else if (type instanceof ArrayType) {
ArrayType arrayType = (ArrayType) type;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,23 @@

import java.net.URI;
import java.sql.SQLException;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;

public final class CanonicalNameConstants {

/*
* Java
*/
public static final String OBJECT = Object.class.getCanonicalName();
public static final String URI = URI.class.getCanonicalName();
public static final String MAP = Map.class.getCanonicalName();
public static final String SET = Set.class.getCanonicalName();
public static final String LIST = List.class.getCanonicalName();
public static final String COLLECTION = Collection.class.getCanonicalName();
public static final String COLLECTIONS = Collections.class.getCanonicalName();
public static final String STRING = String.class.getCanonicalName();
public static final String CHAR_SEQUENCE = CharSequence.class.getCanonicalName();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/**
* Copyright (C) 2010-2012 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.helper;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ public JClass refClass(Class<?> clazz) {
return eBeansHolder.refClass(clazz);
}

public JDefinedClass definedClass(String fullyQualifiedClassName) {
return eBeansHolder.definedClass(fullyQualifiedClassName);
}

public void generateApiClass(Element originatingElement, Class<?> apiClass) {
eBeansHolder.generateApiClass(originatingElement, apiClass);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.androidannotations.helper.CanonicalNameConstants;

import com.sun.codemodel.JClass;
import com.sun.codemodel.JClassAlreadyExistsException;
import com.sun.codemodel.JCodeModel;
import com.sun.codemodel.JDefinedClass;

Expand Down Expand Up @@ -178,6 +179,10 @@ public EBeanHolder getEBeanHolder(Element element) {
return eBeanHolders.get(element);
}

public JClass refClass(Class<?> clazz) {
return codeModel.ref(clazz);
}

public JClass refClass(String fullyQualifiedClassName) {

int arrayCounter = 0;
Expand All @@ -200,8 +205,33 @@ public JClass refClass(String fullyQualifiedClassName) {
return refClass;
}

public JClass refClass(Class<?> clazz) {
return codeModel.ref(clazz);
public JDefinedClass definedClass(String fullyQualifiedClassName) {
JDefinedClass refClass = (JDefinedClass) loadedClasses.get(fullyQualifiedClassName);
if (refClass == null) {
try {
refClass = codeModel._class(fullyQualifiedClassName);
} catch (JClassAlreadyExistsException e) {
refClass = (JDefinedClass) refClass(fullyQualifiedClassName);
}
loadedClasses.put(fullyQualifiedClassName, refClass);
}
return refClass;
}

/**
* Return a unique JClass reference by using {@link JCodeModel#ref(String)}
* and keeping a buffer.
*
* @param fullyQualifiedClassName
* @return
*/
JClass uniqueClass(String fullyQualifiedClassName) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dead code here. This method is never called, can you delete it ?

JClass refClass = loadedClasses.get(fullyQualifiedClassName);
if (refClass == null) {
refClass = codeModel.directClass(fullyQualifiedClassName);
loadedClasses.put(fullyQualifiedClassName, refClass);
}
return refClass;
}

public JCodeModel codeModel() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,13 @@

import org.androidannotations.annotations.rest.Delete;
import org.androidannotations.processing.EBeanHolder;
import com.sun.codemodel.JBlock;

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

public class DeleteProcessor extends MethodProcessor {

private EBeanHolder holder;

public DeleteProcessor(ProcessingEnvironment processingEnv, RestImplementationsHolder restImplementationHolder) {
super(processingEnv, restImplementationHolder);
public DeleteProcessor(ProcessingEnvironment processingEnv, RestImplementationsHolder restImplementationsHolder) {
super(processingEnv, restImplementationsHolder);
}

@Override
Expand All @@ -45,7 +40,6 @@ public Class<? extends Annotation> getTarget() {
@Override
public void process(Element element, JCodeModel codeModel, EBeanHolder holder) throws Exception {

this.holder = holder;
ExecutableElement executableElement = (ExecutableElement) element;

Delete deleteAnnotation = element.getAnnotation(Delete.class);
Expand All @@ -54,25 +48,4 @@ public void process(Element element, JCodeModel codeModel, EBeanHolder holder) t
generateRestTemplateCallBlock(new MethodProcessorHolder(holder, executableElement, urlSuffix, null, null, codeModel));
}

@Override
protected JInvocation addHttpEntityVar(JInvocation restCall, MethodProcessorHolder methodHolder) {
return restCall.arg(JExpr._null());
}

@Override
protected JInvocation addResponseEntityArg(JInvocation restCall, MethodProcessorHolder methodHolder) {
return restCall.arg(JExpr._null());

}

@Override
protected JInvocation addResultCallMethod(JInvocation restCall, MethodProcessorHolder methodHolder) {
return restCall;
}

@Override
protected JVar addHttpHeadersVar(JBlock body, ExecutableElement executableElement) {
return generateHttpHeadersVar(holder, body, executableElement);
}

}
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.