Extension SDK 9.0.5

oracle.jdeveloper.webservices.util
Class MethodSignature

java.lang.Object
  extended byoracle.jdeveloper.webservices.util.MethodSignature

public final class MethodSignature
extends java.lang.Object

A common representation for Java method signatures.


Field Summary
static int INVALID_METHOD_NAME
          Method name is invalid.
static int INVALID_PARAMETER_NAME
          Parameter name is invalid.
static int INVALID_PARAMETER_TYPE
          Parameter type is invalid.
static int INVALID_RETURN_TYPE
          Method return type is invalid.
static int OK
          Method signature is valid.
 
Constructor Summary
MethodSignature()
          Default no-arg constructor for Object2Dom marshalling.
MethodSignature(int modifiers, java.lang.String methodName, java.lang.String returnType)
          Construct a MethodSignature object will the signature data.
MethodSignature(JotMethod method)
          Construct a MethodSignature object based on the JotMethod supplied.
MethodSignature(java.lang.String methodName, java.lang.String returnType)
          Construct a MethodSignature object will the signature data.
 
Method Summary
 void addParameter(java.lang.String paramType, java.lang.String paramName)
          Add a parameter to the method (parameters must be added in the correct order).
 void clearParams()
          Clear the existing parameters.
 boolean equals(java.lang.Object o2)
          Check whether this signature is the same as another.
 JotMethod findMethod(JotClass searchClass)
          Search the supplied JotClass for a method whose signature matches the one encoded in this MethodSignature, and return it.
 JotClass getDeclaringClass(JotClass searchClass)
          Search the supplied JotClass for a method whose signature matches the one encoded in this MethodSignature, and return the JotClass in which that method is declared.
 int getModifiers()
          Get the modifiers for this method.
 java.lang.String getName()
          Get the name of the method.
 java.lang.String[] getParamNames()
          Get the parameter names (in method signature order).
 java.lang.String[] getParamTypes()
          Get the parameter types (in method signature order).
 java.lang.String getReturnType()
          Get the method's return type.
static void main(java.lang.String[] args)
           
 boolean matchesJotMethod(JotMethod jotMethod)
          Check whether this signature matches that of the supplied JotMethod.
static MethodSignature parse(java.lang.String sig)
          Parse the supplied string and create a MethodSignature from it.
 void setModifiers(int modifiers)
          Set the modifiers for this method.
 void setName(java.lang.String methodName)
          Set the name of the method.
 void setParamNames(java.lang.String[] paramNames)
          Method for Object2Dom marshalling only.
 void setParamTypes(java.lang.String[] paramTypes)
          Method for Object2Dom marshalling only.
 void setReturnType(java.lang.String returnType)
          Set the method's return type.
 boolean signaturesEqual(MethodSignature comp, JotClass ctxClass)
          Check whether the signature of this method matches that of the one supplied.
 java.lang.String toString()
           
 boolean typesMatch(java.lang.String type1, java.lang.String type2, JotClass ctxClass)
          Compare the two types given and return true if they are the same.
 int validate(JotClass ctxClass)
          Validate each of the components of the method signature and return a code indicating if any errors were found.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OK

public static final int OK
Method signature is valid.

See Also:
Constant Field Values

INVALID_METHOD_NAME

public static final int INVALID_METHOD_NAME
Method name is invalid.

See Also:
Constant Field Values

INVALID_RETURN_TYPE

public static final int INVALID_RETURN_TYPE
Method return type is invalid.

See Also:
Constant Field Values

INVALID_PARAMETER_NAME

public static final int INVALID_PARAMETER_NAME
Parameter name is invalid.

See Also:
Constant Field Values

INVALID_PARAMETER_TYPE

public static final int INVALID_PARAMETER_TYPE
Parameter type is invalid.

See Also:
Constant Field Values
Constructor Detail

MethodSignature

public MethodSignature()
Default no-arg constructor for Object2Dom marshalling. You should always use one of the other constructors when creating a MethodSignature in code.


MethodSignature

public MethodSignature(java.lang.String methodName,
                       java.lang.String returnType)
Construct a MethodSignature object will the signature data. Parameter data should be added after construction. This is a convenience constructor which defaults the modifier to public.


MethodSignature

public MethodSignature(int modifiers,
                       java.lang.String methodName,
                       java.lang.String returnType)
Construct a MethodSignature object will the signature data. Parameter data should be added after construction.


MethodSignature

public MethodSignature(JotMethod method)
Construct a MethodSignature object based on the JotMethod supplied.

Parameters:
method - JotMethod on which to base the MethodSignature.
Method Detail

setModifiers

public void setModifiers(int modifiers)
Set the modifiers for this method.


getModifiers

public int getModifiers()
Get the modifiers for this method.


setName

public void setName(java.lang.String methodName)
Set the name of the method.


getName

public java.lang.String getName()
Get the name of the method.


setReturnType

public void setReturnType(java.lang.String returnType)
Set the method's return type.


getReturnType

public java.lang.String getReturnType()
Get the method's return type.


addParameter

public void addParameter(java.lang.String paramType,
                         java.lang.String paramName)
Add a parameter to the method (parameters must be added in the correct order).


setParamTypes

public void setParamTypes(java.lang.String[] paramTypes)
Method for Object2Dom marshalling only.


getParamTypes

public java.lang.String[] getParamTypes()
Get the parameter types (in method signature order).


setParamNames

public void setParamNames(java.lang.String[] paramNames)
Method for Object2Dom marshalling only.


getParamNames

public java.lang.String[] getParamNames()
Get the parameter names (in method signature order).


clearParams

public void clearParams()
Clear the existing parameters.


toString

public java.lang.String toString()

findMethod

public JotMethod findMethod(JotClass searchClass)
Search the supplied JotClass for a method whose signature matches the one encoded in this MethodSignature, and return it.

Parameters:
searchClass - The JotClass to search.
Returns:
The JotMethod found, null if no match was made.

getDeclaringClass

public JotClass getDeclaringClass(JotClass searchClass)
Search the supplied JotClass for a method whose signature matches the one encoded in this MethodSignature, and return the JotClass in which that method is declared.

Parameters:
searchClass - The JotClass to search.
Returns:
The JotClass that the method is declared in. This may not be the same as searchClass if searchClass is a subclass. Return value will be null if the method isn't found anywhere in the class.

matchesJotMethod

public boolean matchesJotMethod(JotMethod jotMethod)
Check whether this signature matches that of the supplied JotMethod.

Parameters:
jotMethod - The JotMethod whose signature we should compare against.
Returns:
True if the signatures match.

equals

public boolean equals(java.lang.Object o2)
Check whether this signature is the same as another.

Parameters:
o2 - Other object to compare against this signature.
Returns:
Boolean if the o2 is a matching signature.

signaturesEqual

public boolean signaturesEqual(MethodSignature comp,
                               JotClass ctxClass)
Check whether the signature of this method matches that of the one supplied.

Parameters:
comp - The signature to compare against.
ctxClass - The JotClass that is the context for the comparison.
Returns:
True if the signatures match.

typesMatch

public boolean typesMatch(java.lang.String type1,
                          java.lang.String type2,
                          JotClass ctxClass)
Compare the two types given and return true if they are the same.

Parameters:
type1 - Name of the first type to compare.
type2 - Name of the second type to compare.
ctxClass - The class in which the types appear, required for context.

validate

public int validate(JotClass ctxClass)
Validate each of the components of the method signature and return a code indicating if any errors were found.

Parameters:
ctxClass - Class that the signature will belong to.
Returns:
Integer code corresponding to method's validity. See INVALID_ constants.

main

public static void main(java.lang.String[] args)

parse

public static MethodSignature parse(java.lang.String sig)
Parse the supplied string and create a MethodSignature from it. The form of string that can be parsed by this method is:
methodName (methodType1[, methodType2 ...]) [: methodReturnType]
In other words, this method isn't to be used for parsing Java signatures straight out of a source file. It should be used only to parse strings of the form produced by MethodSignature.toString().

Parameters:
sig - String containing the signature to parse.
Returns:
MethodSignature created from string, null if string didn't parse correctly.

Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.