xapi.annotation.inject.InstanceDefault Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xapi-gwt Show documentation
Show all versions of xapi-gwt Show documentation
This module exists solely to package all other gwt modules into a single
uber jar. This makes deploying to non-mavenized targets much easier.
Of course, you would be wise to inherit your dependencies individually;
the uber jar is intended for projects like collide,
which have complex configuration, and adding many jars would be a pain.
The newest version!
package xapi.annotation.inject;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Used to link an instance implementation class to an injectable interface.
*
*
*
* There can be one and only one @InstanceDefault PER scope class;
*
* A ThreadLocal variable is used to affect what types are injected;
*
*
*
*
*
* Example:
*
*
*
* static interface MyService{}
*
*
*
* @SingletonDefault(implFor=MyService.class)
* static class MyServiceImpl implements MyService{}
*
*
*
* //returns a singleton instance of MyServiceImpl
*
* MyService service = X_Inject.singleton(MyService.class);
*
*
* @author James X. Nelson ([email protected], @james)
*/
@Target(value=ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface InstanceDefault {
/**
* @return - The class object for the instance / class the annotated type is implementing.
* Since your class must implement this interface, it must be on your classpath anyway ;)
*
*/
Class> implFor();
}