Skip to content

Simple annotation processor example. Inspired by the idea of "How ButterKnife works?"

Notifications You must be signed in to change notification settings

erdemtopak/simple-annotation-processor

Repository files navigation

Simple Annotation Processor

A simple annotation processor example, inspired by the idea of "How ButterKnife works?"

In this sample project there are two self-explaining annotations : @RandomInt and @RandomString

They will be used as markers to generate random integers and strings for annotated fields on compile time.

Simple usage of them:

public class TestActivity extends AppCompatActivity {
    
    @RandomInt
    String randomInteger;
    
    @RandomInt(minValue = 1, maxValue = 100)
    int randomIntegerBetween1and100;
    
    @RandomString
    String randomString;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Randomizer.bind(this);
        //... application code
    }
}

About

Simple annotation processor example. Inspired by the idea of "How ButterKnife works?"

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages