dependencies {
compile 'io.ashdavies.auto:auto-decorator:{current-version}'
annotationProcessor 'io.ashdavies.auto:auto-decorator-compiler:{current-version}'
}Normal Usage
Generate decorated implementations for interfaces or abstract classes.
@AutoDecorator
interface Listener {
void onError(Throwable throwable);
}listener = new ListenerDecorator(decorated);Inner Class Usage
If you annotate an inner class its name will be prefixed with the outer class.
class Presenter {
@AutoDecorator
interface Listener {
void onError(Throwable throwable);
}
}listener = new Presenter$ListenerDecorator(decorated);Iterable Usage
Optionally you can generate an implementation that accepts multiple decorated classes. This only works for methods without a return type since the correct return cannot be distinguished. Return types will be supported with the implementation of merge strategies.
@AutoDecorator(iterable = true)
interface Listener {
void onError(Throwable throwable)
}listener = new ListenerDecorator(first, second, third);dependencies {
compile 'io.ashdavies.auto:auto-no-op:{current-version}'
annotationProcessor 'io.ashdavies.auto:auto-no-op-compiler:{current-version}'
}Normal Usage
Generate non operational implementations for interfaces or abstract classes.
@AutoNoOp
interface Listener {
void onError(Throwable throwable);
}listener = new ListenerNoOp();Instance Usage
Optionally, you can instruct the processor to generate a static instance for repeated usage.
@AutoNoOp(instance = true)
interface Listener {
void onError(Throwable throwable);
}listener = ListenerNoOp.instance();Deprecated
Please use JakeWharton/AutoValueAnnotations instead
dependencies {
compile 'io.ashdavies.auto:auto-value:{current-version}'
}