public class ChainedMethodAttributeHandler extends ReadOnlyAttributeHandler
Constructor and Description |
---|
ChainedMethodAttributeHandler(Class objectClass,
String methodName,
AttributeHandler handler,
Class passObjectClass,
Class[] allowedClasses)
Creates a new ChainedMethodAttributeHandler for a method that does not
take any parameters, except possibly the underlying repos object.
|
ChainedMethodAttributeHandler(Class objectClass,
String methodName,
AttributeHandler handler,
int objectParamIndex,
Class[] parameterTypes,
Object[] parameters,
Class[] allowedClasses)
Creates a new ChainedMethodAttributeHandler.
|
ChainedMethodAttributeHandler(Class objectClass,
String methodName,
AttributeHandler handler,
int objectParamIndex,
Class passObjectClass,
Object[] parameters,
Class[] allowedClasses)
Creates a new ChainedMethodAttributeHandler.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canHandle(AttributeHandlerContext context)
Returns true if the repos object returned by the underlying attribute
handler is an instance of the
given objectClass constructor parameter.
|
Object |
getValue(AttributeHandlerContext context)
Returns the value returned by the method registered
for use by this instance.
|
canUpdate, setValue
public ChainedMethodAttributeHandler(Class objectClass, String methodName, AttributeHandler handler, Class passObjectClass, Class[] allowedClasses) throws NoSuchMethodException
objectClass
- the class where the method is defined.methodName
- the name of the method to invoke.handler
- the underlying attribute handler, which must return
an object whose class is that of objectClasspassObjectClass
- if the underlying repos object is to be passed as
a single attribute, the class of the underlying object.
Example: whether a DirectoryUser
is a content manager is determined by calling
Domain.getContentManagerGroup.isUser(member) -- it
takes the underlying object, namely the DU, as a
single argument. Thus the arugment would be
DirectoryObject.class. If the underlying object is not
passed as an argument, specify 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.public ChainedMethodAttributeHandler(Class objectClass, String methodName, AttributeHandler handler, int objectParamIndex, Class passObjectClass, Object[] parameters, Class[] allowedClasses) throws NoSuchMethodException
objectClass
- the class where the method is defined.methodName
- the name of the method to invoke.handler
- the underlying attribute handler, which must return
an object whose class is that of objectClassobjectParamIndex
- whether to pass the underlying repos object as
a parameter, and which java-indexed parameter it
should be. Example: methodName(arg, arg, item, arg)
would take 2 for this argument. Use -1 if the
object should not be passed.passObjectClass
- the class of the underlying repos object.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.public ChainedMethodAttributeHandler(Class objectClass, String methodName, AttributeHandler handler, int objectParamIndex, Class[] parameterTypes, Object[] parameters, Class[] allowedClasses) throws NoSuchMethodException
objectClass
- the class where the method is defined.methodName
- the name of the method to invoke.handler
- the underlying attribute handler, which must return
an object whose class is that of objectClassobjectParamIndex
- whether to pass the underlying repos object as
a parameter, and which java-indexed parameter it
should be. Example: methodName(arg, arg, item, arg)
would take 2 for this argument. Use -1 if the
object should not be passed.parameterTypes
- the parameter types of the method to invoke. The
index matching objectParamIndex should, of course,
be the class of the underlying object.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.public boolean canHandle(AttributeHandlerContext context) throws FdkException, IfsException
context
- The context when this handler is called.FdkException
- If a framework error occurs.IfsException
- If a repository exception occurs.public Object getValue(AttributeHandlerContext context) throws FdkException, IfsException
context
- The context when this handler is called.FdkException
- if the operation fails.IfsException
- If a repository exception occurs.Copyright © 2023. All rights reserved.