|
Oracle Fusion Middleware Java API for Oracle WebLogic Portal 10g Release 3 (10.3.2) E14255-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
com.bea.p13n.expression.internal.ComplexExpressionImpl
com.bea.p13n.expression.operator.Operator
com.bea.p13n.expression.operator.MethodCall
public final class MethodCall
Implementation of the MethodCall operator. The MethodCall operator is used to call an arbitrary Java method using the Java reflection API.
Two forms of method call are supported, static and instance level. For static method calls Input 1 should be set to null and Inputs 2,3,4 are required.
For instance method calls Inputs 1 and 2 are required, inputs 3 and 4 are ignored.
Option 2 (method name) supports dynamic field resolution, therefore:
"out.println" will automatically resolve the method name to an instance field with the name "out".
The examples below both invoke static methods. The first calls the static method "testMethod" on the class "TestStaticMethod" located in the "qa" package. The argument to the method call is a single string.
The second example is equivalent to: java.lang.System.out.println( "### Condition FALSE" )
new MethodCall( "qa", "TestStaticMethod", "testMethod", new Object[] { new String( "### Condition TRUE" ) } );
new MethodCall( "java.lang", "System", "out.println", new Object[] { new String( "### Condition FALSE" ) } ) );
Input 1: An Object (or Expression returning an Object) that is the target of the method call.
Input 2: A String or an Expression returning a String that is the method name to be invoked.
Input 3: A String or an Expression returning a String that is the name of the package for static method calls.
Input 4: A String or an Expression returning a String that is the name of the Class for static method calls.
Input 5-N1: Objects or Expressions returning Objects that serve as arguments to the method call.
Input N1+1-N2: Classes or Expressions returning Classes that identify the Method signature (optional, only required to distinguish between polymorphic methods with the same number of arguments.
Returns: An Object that is the result of the method invocation.
Field Summary | |
---|---|
static int |
MIN_SUBEXPRESSION_COUNT The minimum number of sub-expressions of a valid MethodCall expression. |
Fields inherited from interface com.bea.p13n.expression.ExpressionEvents |
---|
EVENT_ADD_SUBEXPRESSION, EVENT_CLEAR_CACHE, EVENT_INTERNAL_MAX, EVENT_REMOVE_SUBEXPRESSION, EVENT_SET_CACHE_ENABLED, EVENT_SET_CACHED_VALUE, EVENT_SET_PARENT, EVENT_SET_SOURCE, EVENT_SET_SUBEXPRESSION, EVENT_SET_USER_DATA |
Constructor Summary | |
---|---|
MethodCall() |
|
MethodCall(Object target, Object methodName) Allocates a MethodCall object by associating a target object, a method name. |
|
MethodCall(Object staticPackage, Object staticClassName, Object fieldAndMethodName) Allocates a MethodCall object by associating a static package name, a class name and a method name to be called. |
|
MethodCall(Object target, Object methodName, Object[] args) Allocates a MethodCall object by associating a target object, a method name and arguments to be passed to the method call. |
|
MethodCall(Object target, Object methodName, Object[] args, Object[] methodSignature) Allocates a MethodCall object by associating a target object, a method name, arguments to be passed to the method and the method signature. |
|
MethodCall(Object staticPackage, Object staticClassName, Object fieldAndMethodName, Object[] args) Allocates a MethodCall object by associating a static package name, a class name and a method name to be called. |
|
MethodCall(Object staticPackage, Object staticClassName, Object fieldAndMethodName, Object[] args, Object[] methodSignature) Allocates a MethodCall object by associating a static package name, a class name and a method name to be called. |
Method Summary | |
---|---|
protected void |
addArgumentsAndSignature(Object[] args, Object[] methodSignature) Adds the given arguments and method signature as sub expressions. |
Object |
getArgument(int index) Returns an argument at the specified position in the method signature. |
Object[] |
getArgumentArray() Returns an array of Objects representing the arguments to a method. |
int |
getArgumentCount() Returns number of arguments. |
Object |
getMethodName() Returns the method name that will be called on the target object. |
Object |
getMethodSignature(int index) Returns a parameter type of a method signature given the position. |
Class[] |
getMethodSignatureArray() Returns an array of Class storing parameter types which represent a method signature. |
int |
getMethodSignatureLength() Returns the length of the method signature in terms of number of parameters the method accepts. |
Class[] |
getParameterSignature() Returns MethodCall expression's constructor signature |
Object |
getStaticClassName() Returns the Class object. |
Object |
getStaticPackageName() Returns the static package name of a class on which a static method can be called. |
Object |
getTarget() Returns the target object whose method has to be called. |
Methods inherited from class com.bea.p13n.expression.operator.Operator |
---|
leftHandSide, operand, rightHandSide |
Methods inherited from class com.bea.p13n.expression.internal.ComplexExpressionImpl |
---|
addListener, addSubExpression, clearCache, clone, createProxyExpression, equals, getCachedValue, getParent, getSource, getSubExpression, getSubExpressionCount, getUserData, hashCode, isCached, isCacheEnabled, isEqualitySubExpression, notifyListeners, removeAllSubExpressions, removeListener, removeSubExpression, removeSubExpression, setCachedValue, setCacheEnabled, setParent, setSource, setSubExpression, setUserData, toString, write |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int MIN_SUBEXPRESSION_COUNT
MethodCall
expression.
Constructor Detail |
---|
public MethodCall()
public MethodCall(Object target, Object methodName, Object[] args)
MethodCall
object by associating a target object, a method name and arguments to be passed to the method call.
target
- An Object
whose method will be called.methodName
- The name of the method to be called.args
- An array of objects to be passed to the specified method.public MethodCall(Object target, Object methodName, Object[] args, Object[] methodSignature)
MethodCall
object by associating a target object, a method name, arguments to be passed to the method and the method signature.
target
- An Object
whose method will be called.methodName
- The name of the method to be called.args
- An array of objects to be passed to the specified method.methodSignature
- An array of objects containing information about the specified method's signature.public MethodCall(Object target, Object methodName)
MethodCall
object by associating a target object, a method name.
target
- An Object
whose method will be called.methodName
- The name of the method to be called.public MethodCall(Object staticPackage, Object staticClassName, Object fieldAndMethodName)
MethodCall
object by associating a static package name, a class name and a method name to be called.
staticPackage
- The static package name.staticClassName
- The name of the class.fieldAndMethodName
- The method name to be called.public MethodCall(Object staticPackage, Object staticClassName, Object fieldAndMethodName, Object[] args)
MethodCall
object by associating a static package name, a class name and a method name to be called.
staticPackage
- The static package name.staticClassName
- The name of the class.fieldAndMethodName
- The method name to be called.args
- An array of objects representing the arguments to be passed to the specified method.public MethodCall(Object staticPackage, Object staticClassName, Object fieldAndMethodName, Object[] args, Object[] methodSignature)
MethodCall
object by associating a static package name, a class name and a method name to be called.
staticPackage
- The static package name.staticClassName
- The name of the class.fieldAndMethodName
- The method name to be called.args
- An array of objects representing the arguments to be passed to the specified method.methodSignature
- An array of objects containing information about the specified method's signature.Method Detail |
---|
public Object getTarget()
Object
.public Object getMethodName()
Object
representing a method name.public Object getStaticPackageName()
Object
representing a static package name.public Object getStaticClassName()
Object
representing a Class.public Object getMethodSignature(int index)
index
- The position of the parameter whose type has to be returned.Object
representing the type of the parameter.public int getArgumentCount()
public Object[] getArgumentArray()
Objects
representing the arguments to a method.public Object getArgument(int index)
index
- The position of the argument to be returned.Object
representing an argument at the specified position.public Class[] getMethodSignatureArray()
Class
storing parameter types which represent a method signature.Class
containing a method signature in terms of parameter types.public int getMethodSignatureLength()
public Class[] getParameterSignature()
MethodCall
expression's constructor signatureClass
containing parameter types.protected void addArgumentsAndSignature(Object[] args, Object[] methodSignature)
args
- An array of objects to be passed to the specified method.methodSignature
- An array of objects containing information about the specified
|
Oracle Fusion Middleware Java API for Oracle WebLogic Portal 10g Release 3 (10.3.2) E14255-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2010, Oracle. All rights reserved.