public abstract class MethodHandler extends Object implements ResourceModelComponent
Modifier | Constructor and Description |
---|---|
protected |
MethodHandler()
Create new instance of a resource method handler model.
|
protected |
MethodHandler(Collection<Parameter> parameters)
Create new instance of a resource method handler model.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(ResourceModelVisitor visitor)
A component should call the visitor back with an appropriate
visitor interface method to give it a chance to process.
|
static MethodHandler |
create(Class<?> handlerClass)
Create a class-based method handler from a class.
|
static MethodHandler |
create(Class<?> handlerClass,
boolean keepConstructorParamsEncoded)
Create a class-based method handler from a class.
|
static MethodHandler |
create(Class<?> handlerClass,
boolean keepConstructorParamsEncoded,
Collection<Parameter> handlerParameters)
Create a class-based method handler from a class.
|
static MethodHandler |
create(Class<?> handlerClass,
Collection<Parameter> handlerParameters)
Create a class-based method handler from a class.
|
static MethodHandler |
create(Object handlerInstance)
Create a instance-based (singleton) method handler from a class.
|
static MethodHandler |
create(Object handlerInstance,
Class<?> handlerClass)
Create a instance-based (singleton) method handler from a class.
|
static MethodHandler |
create(Object handlerInstance,
Class<?> handlerClass,
Collection<Parameter> handlerParameters)
Create a instance-based (singleton) method handler from a class.
|
static MethodHandler |
create(Object handlerInstance,
Collection<Parameter> handlerParameters)
Create a instance-based (singleton) method handler from a class.
|
List<? extends ResourceModelComponent> |
getComponents()
Should return all existing resource model sub-components.
|
List<HandlerConstructor> |
getConstructors()
Get the resource method handler constructors.
|
abstract Class<?> |
getHandlerClass()
Get the resource method handler class.
|
protected abstract Object |
getHandlerInstance()
Get the raw handler instance that is backing this method handler.
|
abstract Object |
getInstance(org.glassfish.hk2.api.ServiceLocator locator)
Get the injected resource method handler instance.
|
Collection<Parameter> |
getParameters()
Get the parameters associated directly with the resource method handler, if any
(e.g.
|
abstract boolean |
isClassBased()
Return whether the method handler
creates instances
based on classes . |
protected MethodHandler()
protected MethodHandler(Collection<Parameter> parameters)
parameters
- handler parameters associated directly with the resource method handler
(e.g. class-level property setters and fields). May be null
.public static MethodHandler create(Class<?> handlerClass)
handlerClass
- method handler class.public static MethodHandler create(Class<?> handlerClass, boolean keepConstructorParamsEncoded)
handlerClass
- method handler class.keepConstructorParamsEncoded
- if set to true
, any injected constructor
parameters must be kept encoded and must not be automatically decoded.public static MethodHandler create(Object handlerInstance)
handlerInstance
- method handler instance (singleton).public static MethodHandler create(Object handlerInstance, Class<?> handlerClass)
handlerInstance
- method handler instance (singleton).handlerClass
- declared handler class.public static MethodHandler create(Class<?> handlerClass, Collection<Parameter> handlerParameters)
handlerClass
- method handler class.handlerParameters
- method handler parameters (e.g. class-level property setters and fields).public static MethodHandler create(Class<?> handlerClass, boolean keepConstructorParamsEncoded, Collection<Parameter> handlerParameters)
handlerClass
- method handler class.keepConstructorParamsEncoded
- if set to true
, any injected constructor
parameters must be kept encoded and must not be automatically decoded.handlerParameters
- method handler parameters (e.g. class-level property setters and fields).public static MethodHandler create(Object handlerInstance, Collection<Parameter> handlerParameters)
handlerInstance
- method handler instance (singleton).handlerParameters
- method handler parameters (e.g. class-level property setters and fields).public static MethodHandler create(Object handlerInstance, Class<?> handlerClass, Collection<Parameter> handlerParameters)
handlerInstance
- method handler instance (singleton).handlerClass
- declared handler class.handlerParameters
- method handler parameters (e.g. class-level property setters and fields).public abstract Class<?> getHandlerClass()
public List<HandlerConstructor> getConstructors()
public abstract Object getInstance(org.glassfish.hk2.api.ServiceLocator locator)
locator
- service locator that can be used to inject get the instance.public abstract boolean isClassBased()
creates instances
based on classes
.classes
given to HK2, false\
otherwise (for example when method handler was initialized from instance)public Collection<Parameter> getParameters()
Note that this method does not return any parameters associated with
method handler constructors
.
null
.public List<? extends ResourceModelComponent> getComponents()
ResourceModelComponent
getComponents
in interface ResourceModelComponent
public void accept(ResourceModelVisitor visitor)
ResourceModelComponent
accept
in interface ResourceModelComponent
visitor
- resource model visitor.protected abstract Object getHandlerInstance()
null
if the handler is
class-based
.Copyright © 2007-2015, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.