Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.p13n.expression.operator
Class MethodCall

    java.lang.Object
      com.bea.p13n.expression.internal.ComplexExpressionImpl
          com.bea.p13n.expression.operator.Operator
              com.bea.p13n.expression.operator.MethodCall

All Implemented Interfaces
  Expression, com.bea.p13n.expression.ExpressionEvents, Serializable, Cloneable

    public final class MethodCall

extends Operator

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.

See Also
  Serialized Form

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

### MIN_SUBEXPRESSION_COUNT

    public static final int MIN_SUBEXPRESSION_COUNT

  The minimum number of sub-expressions of a valid `MethodCall` expression.

  See Also
    Constants Summary

Constructor Detail

### MethodCall

    public MethodCall()

### MethodCall

    public 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.

  Parameters
    `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.

### MethodCall

    public 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.

  Parameters
    `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.

### MethodCall

    public MethodCall(Object target,
                      Object methodName)

  Allocates a `MethodCall` object by associating a target object, a method name.

  Parameters
    `target` - An `Object` whose method will be called.
    `methodName` - The name of the method to be called.

### MethodCall

    public 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.

  Parameters
    `staticPackage` - The static package name.
    `staticClassName` - The name of the class.
    `fieldAndMethodName` - The method name to be called.

### MethodCall

    public 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.

  Parameters
    `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.

### MethodCall

    public 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.

  Parameters
    `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

### getTarget

    public Object getTarget()

  Returns the target object whose method has to be called.

  Returns
    An `Object`.

### getMethodName

    public Object getMethodName()

  Returns the method name that will be called on the target object.

  Returns
    An `Object` representing a method name.

### getStaticPackageName

    public Object getStaticPackageName()

  Returns the static package name of a class on which a static method can be called.

  Returns
    An `Object` representing a static package name.

### getStaticClassName

    public Object getStaticClassName()

  Returns the Class object.

  Returns
    An `Object` representing a Class.

### getMethodSignature

    public Object getMethodSignature(int index)

  Returns a parameter type of a method signature given the position.

  Parameters
    `index` - The position of the parameter whose type has to be returned.
  Returns
    An `Object` representing the type of the parameter.

### getArgumentCount

    public int getArgumentCount()

  Returns number of arguments.

  Returns
    The number of arguments.

### getArgumentArray

    public Object[] getArgumentArray()

  Returns an array of `Objects` representing the arguments to a method.

  Returns
    An array of objects that are passed to a method as arguments.

### getArgument

    public Object getArgument(int index)

  Returns an argument at the specified position in the method signature.

  Parameters
    `index` - The position of the argument to be returned.
  Returns
    An `Object` representing an argument at the specified position.

### getMethodSignatureArray

    public Class[] getMethodSignatureArray()

  Returns an array of `Class` storing parameter types which represent a method signature.

  Returns
    An array of `Class` containing a method signature in terms of parameter types.

### getMethodSignatureLength

    public int getMethodSignatureLength()

  Returns the length of the method signature in terms of number of parameters the method accepts.

  Returns
    The length of the method signature.

### getParameterSignature

    public Class[] getParameterSignature()

  Returns `MethodCall` expression's constructor signature

  Returns
    An array of `Class` containing parameter types.

### addArgumentsAndSignature

    protected void addArgumentsAndSignature(Object[] args,
                                            Object[] methodSignature)

  Adds the given arguments and method signature as sub expressions.

  Parameters
    `args` - An array of objects to be passed to the specified method.
    `methodSignature` - An array of objects containing information about the specified

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.