forked from androidannotations/androidannotations
-
Notifications
You must be signed in to change notification settings - Fork 0
Adding Functionalities
Romain SERTELON edited this page Jan 6, 2012
·
1 revision
This page is not up to date, the introduction of
CodeModel
to generate code removed the need to use Instruction classes.
This page describes the process to follow when adding annotations and code generation :
- First, check the How to contribute code wiki page
- Import the
AndroidAnnotations
project and the HelloWorldEclipse project. You'll need it to test your changes. - Create a new annotation in the package
com.googlecode.androidannotations.annotations
. It should have a source retention policy. Example: @EActivity. - Create a validator for your annotation, in the package
com.googlecode.androidannotations.validation
. It must implement ElementValidator. It can extend ValidatorHelper which provides helper methods. Example: ExtraValidator. - Create a source generator for your annotation, in the package
com.googlecode.androidannotations.generation
. It must implement Instruction. Example: ValueInstruction. - Create a processor that will take validated elements, then create and add the corresponding instructions in the model, in the package
com.googlecode.androidannotations.processing
. It must implement ElementProcessor. Example: ClickProcessor. - Bind everything in AndroidAnnotationProcessor:
1. Add your annotation to the @SupportedAnnotationClasses class list at the top of the AndroidAnnotationProcessor class.
2. Register your validator in the
buildModelValidator()
method. 3. Register your processor in thebuildModelProcessor()
method. - Test your new annotation with the HelloWorldEclipse project. Once you've configured everything, you only need to delete the
AndroidAnnotation
JAR in the target folder from Eclipse to see it automatically rebuilt and reloaded in HelloWorldEclipse.
AndroidAnnotations was created by Pierre-Yves Ricau and is sponsored by eBusinessInformations.
09/11/2014 The 3.2 release is out !
- Get started!
- Download
- Cookbook, full of recipes
- Customize annotation processing
- List of all available annotations
- Release Notes
- Examples
- Read the FAQ
- Join the Mailing list
- Create an issue
- Tag on Stack Overflow