public class MethodAttributeHandler extends ReadOnlyAttributeHandler
Modifier and Type | Field and Description |
---|---|
protected Class[] |
m_AllowedClasses |
protected Class |
m_Class |
protected Method |
m_Method |
protected Object[] |
m_Parameters |
Constructor and Description |
---|
MethodAttributeHandler(Class objectClass,
String methodName)
Creates a new MethodAttributeHandler for a method
that does not require any parameters.
|
MethodAttributeHandler(Class objectClass,
String methodName,
Class[] parameterTypes,
Object[] parameters,
Class[] allowedClasses)
Creates a new MethodAttributeHandler.
|
MethodAttributeHandler(Class objectClass,
String methodName,
Object[] parameters)
Creates a new MethodAttributeHandler.
|
MethodAttributeHandler(Class objectClass,
String methodName,
Object[] parameters,
Class[] allowedClasses)
Creates a new MethodAttributeHandler.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canHandle(AttributeHandlerContext context)
Returns true if the underlying repos object is an instance of the
given objectClass constructor parameter, or one of the classes in the
given allowedClases array constructor parameter.
|
Object |
getValue(AttributeHandlerContext context)
Returns the value returned by the method registered
for use by this instance.
|
canUpdate, setValue
protected Class m_Class
protected Method m_Method
protected Object[] m_Parameters
protected Class[] m_AllowedClasses
public MethodAttributeHandler(Class objectClass, String methodName) throws NoSuchMethodException
objectClass
- the class where the method is defined.methodName
- the name of the method to invoke.NoSuchMethodException
- if the given method does not exist.public MethodAttributeHandler(Class objectClass, String methodName, Object[] parameters) throws NoSuchMethodException
objectClass
- the class where the method is defined.methodName
- the name of the method to invoke.parameters
- parameters to pass to the method, or null.NoSuchMethodException
- if the given method does not exist.public MethodAttributeHandler(Class objectClass, String methodName, Object[] parameters, Class[] allowedClasses) throws NoSuchMethodException
objectClass
- the class where the method is defined.methodName
- the name of the method to invoke.parameters
- parameters to pass to the method, or null.allowedClasses
- classes allowed to use this AttributeHandler;
this parameter allows clients to further restrict
this AttributeHandler beyond the objectClass
paramter. This parameter may be null, in which
case only the objectClass is used to restrict
the use of this AttributeHandler.NoSuchMethodException
- if the given method does not exist.IllegalArgumentException
- if the allowedClasses parameter is non-null,
has a length greater than 0, and at least
one of its Class elements is not assignable
from the objectClass parameter.public MethodAttributeHandler(Class objectClass, String methodName, Class[] parameterTypes, Object[] parameters, Class[] allowedClasses) throws NoSuchMethodException
objectClass
- the class where the method is defined.methodName
- the name of the method to invoke.parameterTypes
- the parameter types of the method to invoke.parameters
- parameters to pass to the method, or null.allowedClasses
- classes allowed to use this AttributeHandler;
this parameter allows clients to further restrict
this AttributeHandler beyond the objectClass
paramter. This parameter may be null, in which
case only the objectClass is used to restrict
the use of this AttributeHandler.NoSuchMethodException
- if the given method does not exist.IllegalArgumentException
- if the allowedClasses parameter is non-null,
has a length greater than 0, and at least
one of its Class elements is not assignable
from the objectClass parameter.public boolean canHandle(AttributeHandlerContext context)
context
- The context when this handler is called.public Object getValue(AttributeHandlerContext context) throws FdkException
context
- The context when this handler is called.FdkException
- if the operation fails.Copyright © 2023. All rights reserved.