1 23 package com.sun.enterprise.tools.verifier.tests.ejb; 24 25 import java.util.*; 26 import java.lang.reflect.*; 27 28 32 public class MethodUtils { 33 34 41 public static void addMethodNamesToVector(Vector<String > v, Method[] methods) { 42 for (int i=0; i< methods.length; i++) { 43 v.addElement(methods[i].getName()); 45 } 46 } 47 48 56 public static void addMethodNamesToVector(Vector<String > v, Method[] hMethods, Method[] rMethods) { 57 addMethodNamesToVector(v,hMethods); 59 addMethodNamesToVector(v,rMethods); 60 } 61 62 63 71 public static boolean stringArrayEquals(String [] s1, String [] s2) { 72 if (s1 == null && s2 == null) { 73 return true; 74 } 75 if (s1 == null && s2 != null) { 76 return false; 77 } 78 if (s2 == null && s1 != null) { 79 return false; 80 } 81 if (s1.length == s2.length) { 82 for (int i = 0; i < s1.length; i++) { 83 if (!s1[i].equals(s2[i])) { 84 return false; 85 } 86 } 87 return true; 88 } else { 89 return false; 90 } 91 } 92 93 95 public static boolean methodEquals(Method classMethod, Method intfMethod) { 96 return classMethod.getName().equals(intfMethod.getName()) && 97 intfMethod.getReturnType().isAssignableFrom(classMethod.getReturnType()) && 98 Arrays.equals(classMethod.getParameterTypes(), intfMethod.getParameterTypes()); 99 } 100 101 } 102 | Popular Tags |