java.beans
Class Statement

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.beans.Statement
Direct Known Subclasses:
Expression sample code for java.beans.Expression definition code for java.beans.Expression

public class Statement
extends Object sample code for java.lang.Object definition code for java.lang.Object

A Statement object represents a primitive statement in which a single method is applied to a target and a set of arguments - as in "a.setFoo(b)". Note that where this example uses names to denote the target and its argument, a statement object does not require a name space and is constructed with the values themselves. The statement object associates the named method with its environment as a simple set of values: the target and an array of argument values.

Since:
1.4

Constructor Summary
Statement sample code for java.beans.Statement.Statement(java.lang.Object, java.lang.String, java.lang.Object[]) definition code for java.beans.Statement.Statement(java.lang.Object, java.lang.String, java.lang.Object[]) (Object sample code for java.lang.Object definition code for java.lang.Object  target, String sample code for java.lang.String definition code for java.lang.String  methodName, Object sample code for java.lang.Object definition code for java.lang.Object [] arguments)
          Creates a new Statement object with a target, methodName and arguments as per the parameters.
 
Method Summary
 void execute sample code for java.beans.Statement.execute() definition code for java.beans.Statement.execute() ()
          The execute method finds a method whose name is the same as the methodName property, and invokes the method on the target.
 Object sample code for java.lang.Object definition code for java.lang.Object [] getArguments sample code for java.beans.Statement.getArguments() definition code for java.beans.Statement.getArguments() ()
          Returns the arguments of this statement.
 String sample code for java.lang.String definition code for java.lang.String getMethodName sample code for java.beans.Statement.getMethodName() definition code for java.beans.Statement.getMethodName() ()
          Returns the name of the method.
 Object sample code for java.lang.Object definition code for java.lang.Object getTarget sample code for java.beans.Statement.getTarget() definition code for java.beans.Statement.getTarget() ()
          Returns the target of this statement.
 String sample code for java.lang.String definition code for java.lang.String toString sample code for java.beans.Statement.toString() definition code for java.beans.Statement.toString() ()
          Prints the value of this statement using a Java-style syntax.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

Statement sample code for java.beans.Statement(java.lang.Object, java.lang.String, java.lang.Object[]) definition code for java.beans.Statement(java.lang.Object, java.lang.String, java.lang.Object[])

public Statement(Object sample code for java.lang.Object definition code for java.lang.Object  target,
                 String sample code for java.lang.String definition code for java.lang.String  methodName,
                 Object sample code for java.lang.Object definition code for java.lang.Object [] arguments)
Creates a new Statement object with a target, methodName and arguments as per the parameters.

Parameters:
target - The target of this statement.
methodName - The methodName of this statement.
arguments - The arguments of this statement. If null then an empty array will be used.
Method Detail

getTarget sample code for java.beans.Statement.getTarget() definition code for java.beans.Statement.getTarget()

public Object sample code for java.lang.Object definition code for java.lang.Object  getTarget()
Returns the target of this statement.

Returns:
The target of this statement.

getMethodName sample code for java.beans.Statement.getMethodName() definition code for java.beans.Statement.getMethodName()

public String sample code for java.lang.String definition code for java.lang.String  getMethodName()
Returns the name of the method.

Returns:
The name of the method.

getArguments sample code for java.beans.Statement.getArguments() definition code for java.beans.Statement.getArguments()

public Object sample code for java.lang.Object definition code for java.lang.Object [] getArguments()
Returns the arguments of this statement.

Returns:
the arguments of this statement.

execute sample code for java.beans.Statement.execute() definition code for java.beans.Statement.execute()

public void execute()
             throws Exception sample code for java.lang.Exception definition code for java.lang.Exception 
The execute method finds a method whose name is the same as the methodName property, and invokes the method on the target. When the target's class defines many methods with the given name the implementation should choose the most specific method using the algorithm specified in the Java Language Specification (15.11). The dynamic class of the target and arguments are used in place of the compile-time type information and, like the java.lang.reflect.Method class itself, conversion between primitive values and their associated wrapper classes is handled internally.

The following method types are handled as special cases:

Throws:
Exception sample code for java.lang.Exception definition code for java.lang.Exception

toString sample code for java.beans.Statement.toString() definition code for java.beans.Statement.toString()

public String sample code for java.lang.String definition code for java.lang.String  toString()
Prints the value of this statement using a Java-style syntax.

Overrides:
toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
a string representation of the object.