com.artemis.annotations.Wire Maven / Gradle / Ivy
Show all versions of artemis-odb Show documentation
package com.artemis.annotations;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import com.artemis.ComponentMapper;
import com.artemis.EntityFactory;
import com.artemis.EntitySystem;
import com.artemis.Manager;
import com.artemis.World;
/**
* Reflexively injects {@link ComponentMapper}, {@link EntitySystem},
* {@link Manager} and {@link EntityFactory} fields upon calling
* {@link World#setSystem(com.artemis.BaseSystem)} or
* {@link World#setManager(com.artemis.Manager)}.
*
*
*
* Inject into any object using @Wire
and {@link World#inject(Object)}
*
* Nonstandard dependency fields must be explicitly annotated with
* @Wire(name="myName")
to inject by name, or @Wire
* to inject by type. Class level @Wire
annotation is not enough.
*
* To specify which nonstandard dependencies to inject, use
* {@link com.artemis.WorldConfiguration#register(String, Object)} and
* {@link com.artemis.WorldConfiguration#register(Object)}.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.TYPE})
@Documented
public @interface Wire {
/**
* If true, also inject inherited fields.
*/
boolean injectInherited() default false;
/**
* Throws a {@link NullPointerException} if field can't be injected.
*/
boolean failOnNull() default true;
/**
*
*/
String name() default "";
}