Package org.glassfish.tyrus.core
Class ComponentProvider
- java.lang.Object
-
- org.glassfish.tyrus.core.ComponentProvider
-
- Direct Known Subclasses:
CdiComponentProvider
,DefaultComponentProvider
,EjbComponentProvider
public abstract class ComponentProvider extends java.lang.Object
Provides an instance.Method
isApplicable(Class)
is called first to check whether the provider is able to provide the givenClass
. Methodcreate(Class)
is called to get the instance.- Author:
- Stepan Kopriva (stepan.kopriva at oracle.com), Martin Matula (martin.matula at oracle.com), Pavel Bucek (pavel.bucek at oracle.com)
-
-
Constructor Summary
Constructors Constructor Description ComponentProvider()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract <T> java.lang.Object
create(java.lang.Class<T> c)
Create new instance.abstract boolean
destroy(java.lang.Object o)
Destroys the given managed instance.java.lang.reflect.Method
getInvocableMethod(java.lang.reflect.Method method)
Get the method which should be invoked instead provided one.abstract boolean
isApplicable(java.lang.Class<?> c)
Checks whether this component provider is able to provide an instance of givenClass
.
-
-
-
Method Detail
-
isApplicable
public abstract boolean isApplicable(java.lang.Class<?> c)
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
public abstract <T> java.lang.Object create(java.lang.Class<T> c)
Create new instance.- Type Parameters:
T
- type of the created object.- Parameters:
c
-Class
to be created.- Returns:
- instance, iff found,
null
otherwise.
-
getInvocableMethod
public java.lang.reflect.Method getInvocableMethod(java.lang.reflect.Method method)
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
public abstract boolean destroy(java.lang.Object o)
Destroys the given managed instance.- Parameters:
o
- instance to be destroyed.- Returns:
true
iff the instance was coupled to thisComponentProvider
, false otherwise.
-
-