java.beans
Class Statement
A Statement captures the execution of an object method. It stores
the object, the method to call, and the arguments to the method and
provides the ability to execute the method on the object, using the
provided arguments.
Statement(Object target, String methodName, Object[] arguments) - Constructs a statement representing the invocation of
object.methodName(arg[0], arg[1], ...);
If the argument array is null it is replaced with an
array of zero length.
|
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
Statement
public Statement(Object target,
String methodName,
Object[] arguments)
Constructs a statement representing the invocation of
object.methodName(arg[0], arg[1], ...);
If the argument array is null it is replaced with an
array of zero length.
target
- The object to invoke the method on.methodName
- The object method to invoke.arguments
- An array of arguments to pass to the method.
execute
public void execute()
throws Exception
Execute the statement.
Finds the specified method in the target object and calls it with
the arguments given in the constructor.
The most specific method according to the JLS(15.11) is used when
there are multiple methods with the same name.
Execute performs some special handling for methods and
parameters:
- Static methods can be executed by providing the class as a
target.
- The method name new is reserved to call the constructor
new() will construct an object and return it. Not useful unless
an expression :-)
- If the target is an array, get and set as defined in
java.util.List are recognized as valid methods and mapped to the
methods of the same name in java.lang.reflect.Array.
- The native datatype wrappers Boolean, Byte, Character, Double,
Float, Integer, Long, and Short will map to methods that have
native datatypes as parameters, in the same way as Method.invoke.
However, these wrappers also select methods that actually take
the wrapper type as an argument.
The Sun spec doesn't deal with overloading between int and
Integer carefully. If there are two methods, one that takes an
Integer and the other taking an int, the method chosen is not
specified, and can depend on the order in which the methods are
declared in the source file.
Exception
- if an exception occurs while locating or
invoking the method.
toString
public String toString()
Returns a string representation of this Statement
.
- toString in interface Object
- A string representation of this
Statement
.
Statement.java
Copyright (C) 2004, 2005, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.