Package org.glassfish.tyrus.core
Class ComponentProvider
- java.lang.Object
-
- org.glassfish.tyrus.core.ComponentProvider
-
- Direct Known Subclasses:
DefaultComponentProvider
public abstract class ComponentProvider extends java.lang.ObjectProvides 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, Martin Matula, Pavel Bucek
-
-
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.Objectcreate(java.lang.Class<T> c)Create new instance.abstract booleandestroy(java.lang.Object o)Destroys the given managed instance.java.lang.reflect.MethodgetInvocableMethod(java.lang.reflect.Method method)Get the method which should be invoked instead provided one.abstract booleanisApplicable(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-Classto be checked.- Returns:
trueiff thisComponentProvideris 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-Classto be created.- Returns:
- instance, iff found,
nullotherwise.
-
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:
trueiff the instance was coupled to thisComponentProvider, false otherwise.
-
-