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 1 commit
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
Next Next commit
HttpsClient annotation
Signed-off-by: Nabil Hachicha <nabil.hachicha@gmail.com>
  • Loading branch information
nhachicha committed Jun 4, 2012
commit 0151060e78eaf22235e8d83f370cd4424665e2ea
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import com.googlecode.androidannotations.annotations.FragmentByTag;
import com.googlecode.androidannotations.annotations.FromHtml;
import com.googlecode.androidannotations.annotations.Fullscreen;
import com.googlecode.androidannotations.annotations.HttpsClient;
import com.googlecode.androidannotations.annotations.InstanceState;
import com.googlecode.androidannotations.annotations.ItemClick;
import com.googlecode.androidannotations.annotations.ItemLongClick;
Expand Down Expand Up @@ -133,6 +134,7 @@
import com.googlecode.androidannotations.processing.FragmentByTagProcessor;
import com.googlecode.androidannotations.processing.FromHtmlProcessor;
import com.googlecode.androidannotations.processing.FullscreenProcessor;
import com.googlecode.androidannotations.processing.HttpsClientProcessor;
import com.googlecode.androidannotations.processing.InstanceStateProcessor;
import com.googlecode.androidannotations.processing.ItemClickProcessor;
import com.googlecode.androidannotations.processing.ItemLongClickProcessor;
Expand Down Expand Up @@ -190,6 +192,7 @@
import com.googlecode.androidannotations.validation.FragmentByTagValidator;
import com.googlecode.androidannotations.validation.FromHtmlValidator;
import com.googlecode.androidannotations.validation.FullscreenValidator;
import com.googlecode.androidannotations.validation.HttpsClientValidator;
import com.googlecode.androidannotations.validation.InstanceStateValidator;
import com.googlecode.androidannotations.validation.ItemClickValidator;
import com.googlecode.androidannotations.validation.ItemLongClickValidator;
Expand Down Expand Up @@ -291,8 +294,8 @@
FragmentByTag.class, //
BeforeTextChange.class, //
TextChange.class, //
AfterTextChange.class //
})
AfterTextChange.class, //
HttpsClient.class })
@SupportedSourceVersion(SourceVersion.RELEASE_6)
public class AndroidAnnotationProcessor extends AnnotatedAbstractProcessor {

Expand Down Expand Up @@ -460,6 +463,7 @@ private ModelValidator buildModelValidator(IRClass rClass, AndroidSystemServices
modelValidator.register(new BeforeTextChangeValidator(processingEnv, rClass));
modelValidator.register(new TextChangeValidator(processingEnv, rClass));
modelValidator.register(new AfterTextChangeValidator(processingEnv, rClass));
modelValidator.register(new HttpsClientValidator(processingEnv, rClass));
return modelValidator;
}

Expand Down Expand Up @@ -538,6 +542,7 @@ private ModelProcessor buildModelProcessor(IRClass rClass, AndroidSystemServices
modelProcessor.register(new TextChangeProcessor(processingEnv, rClass));
modelProcessor.register(new BeforeTextChangeProcessor(processingEnv, rClass));
modelProcessor.register(new AfterTextChangeProcessor(processingEnv, rClass));
modelProcessor.register(new HttpsClientProcessor());
return modelProcessor;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ public void idExists(Element element, Res res, boolean defaultUseName, boolean a
idExists(element, res, defaultUseName, allowDefault, valid, idValue);
}

public void idExists(Element element, Res res, boolean defaultUseName, boolean allowDefault, IsValid valid, String methodName) {

Integer idValue = annotationHelper.extractAnnotationValue(element, methodName);

idExists(element, res, defaultUseName, allowDefault, valid, idValue);
}

public void idsExists(Element element, Res res, IsValid valid) {

int[] idsValues = annotationHelper.extractAnnotationValue(element);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,19 @@ public <T> T extractAnnotationValue(Element element) {
}
}

@SuppressWarnings("unchecked")
public <T> T extractAnnotationValue(Element element, String methodName) {
Annotation annotation = element.getAnnotation(target);

Method method;
try {
method = annotation.getClass().getMethod(methodName);
return (T) method.invoke(annotation);
} catch (Exception e) {
throw new RuntimeException(e);
}
}

public DeclaredType extractAnnotationClassValue(Element element) {

AnnotationMirror annotationMirror = findAnnotationMirror(element, target);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
public interface IRClass {

public enum Res {
LAYOUT, ID, STRING, ARRAY, COLOR, ANIM, BOOL, DIMEN, DRAWABLE, INTEGER, MOVIE, MENU;
LAYOUT, ID, STRING, ARRAY, COLOR, ANIM, BOOL, DIMEN, DRAWABLE, INTEGER, MOVIE, MENU, RAW;
public String rName() {
return toString().toLowerCase();
}
Expand Down
7 changes: 7 additions & 0 deletions AndroidAnnotations/functional-test-1-5-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>bouncycastle</groupId>
<artifactId>bcprov-jdk16</artifactId>
<version>140</version>
</dependency>

</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
eclipse.preferences.version=1
org.eclipse.jdt.apt.aptEnabled=true
org.eclipse.jdt.apt.genSrcDir=.apt_generated
org.eclipse.jdt.apt.genSrcDir=.apt_generatedd
org.eclipse.jdt.apt.processorOptions/trace=true
org.eclipse.jdt.apt.reconcileEnabled=true
1 change: 1 addition & 0 deletions AndroidAnnotations/functional-test-1-5/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<activity android:name="com.googlecode.androidannotations.test15.nonconfiguration.NonConfigurationActivity_" />
<activity android:name="com.googlecode.androidannotations.test15.sherlock.MySherlockActivity_" />
<activity android:name="com.googlecode.androidannotations.test15.efragment.MyFragmentActivity_" />
<activity android:name=".SSLConnection_" />

<receiver android:name="com.googlecode.androidannotations.test15.ereceiver.MyReceiver_" />

Expand Down
2 changes: 1 addition & 1 deletion androidannotations-dependencies/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry exported="true" kind="lib" path="codemodel-2.4.1.jar"/>
<classpathentry exported="true" kind="lib" path="android-1.6_r2.jar"/>
<classpathentry kind="lib" path="android-1.6_r2.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>