ebul-cmp/src/main/java/info/ebenoit/ebul/cmp/ComponentSingleton.java
Emmanuel BENOîT 3dc2f5b8d1 Automatically-added singletons
The registry can maintain a set of classes that contain annotated
singletons corresponding to the components.
2015-09-17 22:06:53 +02:00

27 lines
No EOL
729 B
Java

package info.ebenoit.ebul.cmp;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* This annotation can be used to create automatically filled singleton fields that correspond to components. It can
* only be used on static, public fields.
* <p>
* If a string is given, it will be used as the component's name. Otherwise the component to fetch will be determined
* using the field's type.
*
* @author <a href="mailto:ebenoit@ebenoit.info">E. Benoît</a>
*/
@Retention( RetentionPolicy.RUNTIME )
@Target( ElementType.METHOD )
public @interface ComponentSingleton
{
public String value( ) default "";
}