gnu.gnustep.base
Class NSSelector

java.lang.Object
  |
  +--gnu.gnustep.base.NSSelector
All Implemented Interfaces:
java.lang.Cloneable

public final class NSSelector
extends java.lang.Object
implements java.lang.Cloneable

This class wraps Objective-C selectors. In Java a selector is univocally identified by the method name and the type of its arguments (which is an array of Class objects).


Constructor Summary
NSSelector(java.lang.String aMethodName, java.lang.Class[] someParameterTypes)
          Constructs a selector with method name aMethodName, and accepting an array of parameters of types specified by someParameterTypes.
NSSelector(java.lang.String aMethodName, java.lang.String argumentSignature)
          This is the constructor JIGS invokes from objective-C when morphing an objective-C selector - from Java it's much easier to use the other constructor.
 
Method Summary
 java.lang.Object clone()
           
 boolean equals(java.lang.Object otherObject)
          Returns true if and only if otherObject is a NSSelector with the same method name, and argument types.
 int hashCode()
           
 boolean implementedByClass(java.lang.Class targetClass)
          Returns true if targetClass implements this selector (that is, if it implements a method with this name and taking these parameter types).
 boolean implementedByObject(java.lang.Object target)
          Returns true if the class of target implements this selector (that is, if it implements a method with this name and taking these parameter types).
 java.lang.Object invoke(java.lang.Object target)
           
 java.lang.Object invoke(java.lang.Object target, java.lang.Object argument)
           
 java.lang.Object invoke(java.lang.Object target, java.lang.Object[] arguments)
           
 java.lang.Object invoke(java.lang.Object target, java.lang.Object argument1, java.lang.Object argument2)
           
 java.lang.reflect.Method methodOnClass(java.lang.Class targetClass)
           
 java.lang.reflect.Method methodOnObject(java.lang.Object target)
           
 java.lang.String name()
           
 java.lang.Class[] parameterTypes()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NSSelector

public NSSelector(java.lang.String aMethodName,
                  java.lang.Class[] someParameterTypes)
Constructs a selector with method name aMethodName, and accepting an array of parameters of types specified by someParameterTypes.

NSSelector

public NSSelector(java.lang.String aMethodName,
                  java.lang.String argumentSignature)
           throws java.lang.ClassNotFoundException
This is the constructor JIGS invokes from objective-C when morphing an objective-C selector - from Java it's much easier to use the other constructor.
Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException

equals

public boolean equals(java.lang.Object otherObject)
Returns true if and only if otherObject is a NSSelector with the same method name, and argument types.
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

implementedByClass

public boolean implementedByClass(java.lang.Class targetClass)
Returns true if targetClass implements this selector (that is, if it implements a method with this name and taking these parameter types).

implementedByObject

public boolean implementedByObject(java.lang.Object target)
Returns true if the class of target implements this selector (that is, if it implements a method with this name and taking these parameter types).

invoke

public java.lang.Object invoke(java.lang.Object target,
                               java.lang.Object[] arguments)
                        throws java.lang.NoSuchMethodException,
                               java.lang.SecurityException,
                               java.lang.IllegalAccessException,
                               java.lang.IllegalArgumentException,
                               java.lang.reflect.InvocationTargetException

invoke

public java.lang.Object invoke(java.lang.Object target)
                        throws java.lang.NoSuchMethodException,
                               java.lang.SecurityException,
                               java.lang.IllegalAccessException,
                               java.lang.IllegalArgumentException,
                               java.lang.reflect.InvocationTargetException

invoke

public java.lang.Object invoke(java.lang.Object target,
                               java.lang.Object argument)
                        throws java.lang.NoSuchMethodException,
                               java.lang.SecurityException,
                               java.lang.IllegalAccessException,
                               java.lang.IllegalArgumentException,
                               java.lang.reflect.InvocationTargetException

invoke

public java.lang.Object invoke(java.lang.Object target,
                               java.lang.Object argument1,
                               java.lang.Object argument2)
                        throws java.lang.NoSuchMethodException,
                               java.lang.SecurityException,
                               java.lang.IllegalAccessException,
                               java.lang.IllegalArgumentException,
                               java.lang.reflect.InvocationTargetException

methodOnClass

public java.lang.reflect.Method methodOnClass(java.lang.Class targetClass)
                                       throws java.lang.NoSuchMethodException,
                                              java.lang.SecurityException

methodOnObject

public java.lang.reflect.Method methodOnObject(java.lang.Object target)
                                        throws java.lang.NoSuchMethodException,
                                               java.lang.SecurityException

name

public java.lang.String name()

parameterTypes

public java.lang.Class[] parameterTypes()