public class ServiceBinderImpl extends Object implements ServiceBinder, ServiceBindingOptions
Constructor and Description |
---|
ServiceBinderImpl(ServiceDefAccumulator accumulator,
Method bindMethod,
PlasticProxyFactory proxyFactory,
Set<Class> defaultMarkers,
boolean moduleDefaultPreventDecoration) |
Modifier and Type | Method and Description |
---|---|
<T> ServiceBindingOptions |
bind(Class<T> serviceClass)
Defines a service in terms of an implementation class, without a service interface.
|
<T> ServiceBindingOptions |
bind(Class<T> serviceInterface,
Class<? extends T> serviceImplementation)
Binds the service interface to a service implementation class.
|
<T> ServiceBindingOptions |
bind(Class<T> serviceInterface,
ServiceBuilder<T> builder)
Alternative implementation that supports a callback to build the service, rather than instantiating a particular
class.
|
ServiceBindingOptions |
eagerLoad()
Turns eager loading on for this service.
|
void |
finish() |
protected void |
flush() |
ServiceBindingOptions |
preventDecoration()
Disallows service decoration for this service.
|
ServiceBindingOptions |
preventReloading()
Identifies a service for which live class reloading is not desired.
|
ServiceBindingOptions |
scope(String scope)
Sets the scope of the service, overriding the
Scope annotation on the service implementation class. |
ServiceBindingOptions |
withId(String id)
Allows a specific service id for the service to be provided, rather than the default (from the service
interface).
|
ServiceBindingOptions |
withMarker(Class<? extends Annotation>... marker)
Defines the marker interface(s) for the service, used to connect injections by type at the point of injection
with a particular service implementation, based on the intersection of type and marker interface.
|
ServiceBindingOptions |
withSimpleId()
Uses the the simple (unqualified) class name of the implementation class as the id of the service.
|
public ServiceBinderImpl(ServiceDefAccumulator accumulator, Method bindMethod, PlasticProxyFactory proxyFactory, Set<Class> defaultMarkers, boolean moduleDefaultPreventDecoration)
public void finish()
protected void flush()
public <T> ServiceBindingOptions bind(Class<T> serviceClass)
ServiceBinder
ServiceDef.getServiceInterface()
will
return the implementation class. In this situation, the service will not be proxied; it will be instantiated
fully on first reference (ignoring its scope, if any) and will not be decorated.bind
in interface ServiceBinder
serviceClass
- class to instantiate as the servicepublic <T> ServiceBindingOptions bind(Class<T> serviceInterface, ServiceBuilder<T> builder)
ServiceBinder
bind
in interface ServiceBinder
serviceInterface
- interface implemented by the servicebuilder
- constructs the core service implementationpublic <T> ServiceBindingOptions bind(Class<T> serviceInterface, Class<? extends T> serviceImplementation)
ServiceBinder
Scope
annotation.bind
in interface ServiceBinder
serviceInterface
- service interface (used when locating services, and when building proxies)serviceImplementation
- implementation class that implements the service interfacepublic ServiceBindingOptions eagerLoad()
ServiceBindingOptions
EagerLoad
annotation on
the service implementation class.eagerLoad
in interface ServiceBindingOptions
public ServiceBindingOptions preventDecoration()
ServiceBindingOptions
preventDecoration
in interface ServiceBindingOptions
public ServiceBindingOptions preventReloading()
ServiceBindingOptions
preventReloading
in interface ServiceBindingOptions
public ServiceBindingOptions withId(String id)
ServiceBindingOptions
withId
in interface ServiceBindingOptions
public ServiceBindingOptions withSimpleId()
ServiceBindingOptions
withSimpleId
in interface ServiceBindingOptions
public ServiceBindingOptions scope(String scope)
ServiceBindingOptions
Scope
annotation on the service implementation class.scope
in interface ServiceBindingOptions
ScopeConstants
public ServiceBindingOptions withMarker(Class<? extends Annotation>... marker)
ServiceBindingOptions
withMarker
in interface ServiceBindingOptions
marker
- one or more markers to add5.6.3 - Copyright © 2003-2021 The Apache Software Foundation.