The ObjectProviders
configuration drives the object
translator. Contributions
define an object provider in terms of a prefix (such as service
)
and a service that implements the ObjectProvider
interface.
Object providers exist to support object references. Object references are a way to contribute objects that may be references to services, or to other objects, or may even be created on the spot. This is often used with the hivemind.BuilderFactory's <set-object> element.
An object reference consists of a prefix and a locator seperated by a colon. The interpretation of the locator is different for each provider. The prefix determines which provider will be utilized to interpret the locator.
The contribution format defines the name and class for each service model:
<provider prefix="..." service-id="..."/>
Prefixes must be unique.
The following default prefixes are available:
Prefix | Descripton | Example |
---|---|---|
bean | The locator is a BeanFactory locator, consisting of the id of a BeanFactory service, a colon, and an optional initializer for the bean. | bean:ValidatorFactory:string,required |
class | The locator is a class name. It may be a partial class name, with the package name provided by the contributing module. | class:java.util.List |
configuration | The locator is the id of a configuration. | configuration:MyConfiguration |
instance | The locator is a class name, which must have a public no arguments contructor. You may use instance initializer syntax. | instance:com.example.MyObject |
service | The locator is the id of a service. | service:MyService |
service-property | The locator provides a service id and a property name (provided by that service), seperated with a colon. | service-property:MyService:activeRequest |
spring | The locator is the name of a bean within a Spring BeanFactory. | spring:MyBean |
Note:
The bean: and spring: prefixes are provided by the HiveMind library (not the base framework).