Skip to content
Daan van Yperen edited this page Sep 29, 2015 · 1 revision

FieldHandler

The FieldHandler is responsible for providing value for fields eligible for dependency injection. When the Injectorencounters a field, it calls FieldHandler.resolve(Class<?>, Field), and if it returns a non-null value, it will be assigned to the field.

The FieldHandler maintains a list of FieldResolvers, and calls FieldResolver.resolve(Class<?>, Field) until a resolver returns a non-null value.

FieldHandler can be fully sub-classed if the default implementation provides too limiting.

Constructors

  • FieldHandler(InjectionCache): Creates a FieldHandler with ArtemisFieldResolver
  • FieldHandler(InjectionCache, Map<String, Object>): Creates an FieldHandler with ArtemisFieldResolver and WiredFieldResolver, the latter instansiated with the provided injectables.
  • FieldHandler(InjectionCache, Bag<FieldResolver>): Creates a FieldHander with the provided resolvers. Note: For world-injection to work correctly, the bag should contain ArtemisFieldResolver, or ArtemisFieldResolver should be added via 'FieldHandler.addResolver' prior to calling new World().
Clone this wiki locally