FileDocCategorySizeDatePackage
MethodUtils.javaAPI DocGlassfish v2 API4478Fri May 04 22:33:32 BST 2007com.sun.enterprise.tools.verifier.tests.ejb

MethodUtils

public class MethodUtils extends Object
Utility package for dealing with method descriptors from element and elements

Fields Summary
Constructors Summary
Methods Summary
public static voidaddMethodNamesToVector(java.util.Vector v, java.lang.reflect.Method[] methods)
Add method name to vector

param
v Vector to be added to
param
methods array of methods to be added to vector

        for (int i=0; i< methods.length; i++) {
            // add method name to vector
            v.addElement(methods[i].getName());
        }
    
public static voidaddMethodNamesToVector(java.util.Vector v, java.lang.reflect.Method[] hMethods, java.lang.reflect.Method[] rMethods)
Determine is method parameters are equal.

param
v Vector to be added to
param
hMethods array of home interface methods to be added to vector
param
rMethods array of remote interface methods to be added to vector

        // add method names to vector for both home and remote interfaces
        addMethodNamesToVector(v,hMethods);
        addMethodNamesToVector(v,rMethods);
    
public static booleanmethodEquals(java.lang.reflect.Method classMethod, java.lang.reflect.Method intfMethod)
returns true if method names, return types and parameters match. Otherwise it returns false.

        return classMethod.getName().equals(intfMethod.getName()) &&
                intfMethod.getReturnType().isAssignableFrom(classMethod.getReturnType()) &&
                Arrays.equals(classMethod.getParameterTypes(), intfMethod.getParameterTypes());
    
public static booleanstringArrayEquals(java.lang.String[] s1, java.lang.String[] s2)
Determine is method parameters are equal.

param
s1 array of parameters for method
param
s2 array of parameters for method
return
boolean the results for this parameter equality test

        if (s1 == null && s2 == null) {
            return true;
        }
        if (s1 == null && s2 != null) {
            return false;
        }
        if (s2 == null && s1 != null) {
            return false;
        }
        if (s1.length == s2.length) {
            for (int i = 0; i < s1.length; i++) {
                if (!s1[i].equals(s2[i])) {
                    return false;
                }
            }
            return true;
        } else {
            return false;
        }