Package org.glassfish.tyrus.core
Class ComponentProvider
java.lang.Object
org.glassfish.tyrus.core.ComponentProvider
- Direct Known Subclasses:
CdiComponentProvider
,DefaultComponentProvider
,EjbComponentProvider
Provides an instance.
Method isApplicable(Class)
is called first to check whether the provider is able to provide the given
Class
. Method create(Class)
is called to get the instance.
- Author:
- Stepan Kopriva, Martin Matula, Pavel Bucek
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract <T> Object
Create new instance.abstract boolean
Destroys the given managed instance.getInvocableMethod
(Method method) Get the method which should be invoked instead provided one.abstract boolean
isApplicable
(Class<?> c) Checks whether this component provider is able to provide an instance of givenClass
.
-
Constructor Details
-
ComponentProvider
public ComponentProvider()
-
-
Method Details
-
isApplicable
Checks whether this component provider is able to provide an instance of givenClass
.- Parameters:
c
-Class
to be checked.- Returns:
true
iff thisComponentProvider
is able to create an instance of the givenClass
.
-
create
Create new instance.- Type Parameters:
T
- type of the created object.- Parameters:
c
-Class
to be created.- Returns:
- instance, iff found,
null
otherwise.
-
getInvocableMethod
Get the method which should be invoked instead provided one.Useful mainly for EJB container support, where methods from endpoint class cannot be invoked directly - Tyrus needs to use method declared on remote interface.
Default implementation returns method provided as parameter.
- Parameters:
method
- method from endpoint class.- Returns:
- method which should be invoked.
-
destroy
Destroys the given managed instance.- Parameters:
o
- instance to be destroyed.- Returns:
true
iff the instance was coupled to thisComponentProvider
, false otherwise.
-