com.github.t1.annotations.MixinFor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of power-annotations Show documentation
Show all versions of power-annotations Show documentation
The Annotations resolved by Power Annotations
package com.github.t1.annotations;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
/**
* Add annotations to another class that you can't change; if you can change that class,
* use explicit {@link Stereotype}s instead. Using Mixins is very implicit and difficult to trace back;
* it is often better to actually copy the target class, so you can directly add your annotations,
* instead of working with mixins. You have been warned!
*
* If you have a class that you don't control, e.g.:
*
*
* public class ImportedClass {
* ...
* }
*
*
* And you need it to be annotated as @SomeAnnotation
. Then you can write a mixin (the name is arbitrary):
*
*
* @MixinFor(ImportedClass.class)
* @SomeAnnotation
* public class ImportedClassMixin {
* ...
* }
*
*
* After the Power Annotations have been resolved, the target class looks as if it had another annotation:
*
*
* @SomeAnnotation
* public class ImportedClass {
* ...
* }
*
*/
@Retention(RUNTIME)
@Target(TYPE)
public @interface MixinFor {
Class> value();
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy