@Retention(value=RUNTIME) @Target(value={FIELD,TYPE}) @Documented public @interface Wire
ComponentMapper
, EntitySystem
,
Manager
, and registered types via WorldConfiguration.register(java.lang.Object)
.
Odb automatically injects above types into entity systems, during initialization.
Inject into any object using @Wire
and 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.
By default, systems inject inherited fields from superclasses.
Override this behavior with @Wire(injectInherited=false)
.
By default, if @Wire
fails to inject a field - typically because the requested
type hasn't been added to the world instance - a MundaneWireException is thrown.
Override this behavior via @Wire(failOnNull=false)
.
To specify which nonstandard dependencies to inject, use
WorldConfiguration.register(String, Object)
and
WorldConfiguration.register(Object)
.AspectDescriptor
Modifier and Type | Optional Element and Description |
---|---|
boolean |
failOnNull
Throws a
NullPointerException if field can't be injected. |
boolean |
injectInherited
If true, also inject inherited fields.
|
String |
name |
public abstract boolean injectInherited
public abstract boolean failOnNull
NullPointerException
if field can't be injected.public abstract String name
Copyright © 2019. All rights reserved.