/** * Return true if the JavaClass passed in has the Method defined * on it. Return false if the Method is defined on a supertype or * is not defined on the class at all. */ public static final boolean onClass(JavaClass clazz, Method method) { if((clazz == null) || (method == null)) { return false; } return clazz.equals(method.getJavaClass()); }
public static MethodElement getMostSpecificMethodElement(List methodElements, Method aMethod) { MethodElement specificME = null; if (aMethod != null) { Iterator it = methodElements.iterator(); MethodElement me; while (it.hasNext()) { me = (MethodElement) it.next(); if (me.represents(aMethod)) { if (me.uniquelyIdentifies(aMethod)) return me; else if (specificME == null) specificME = me; else specificME = specificME.getMostSpecific(me, aMethod.getJavaClass()); } } } return specificME; } protected String getParmsString() {
public final boolean isEJBInterfaceMethod(EnterpriseBean bean, Method method) throws InvalidInputException { long[] superTypes = getSupertypes(); for(int i=0; i<superTypes.length; i++) { if(ClassUtility.getUtility().isClassType(bean, method.getJavaClass(), superTypes[i])) { return true; } } return false; }
protected final boolean isOwnedByBase(EnterpriseBean bean, Method method) throws InvalidInputException { if (method == null) { return false; } long[] baseTypes = getBaseTypes(); if (baseTypes == null) { // no parents return false; } for (int i = 0; i < baseTypes.length; i++) { if (ClassUtility.getUtility().isClassType(bean, method.getJavaClass(), baseTypes[i])) { return true; } } return false; }
/** * represents method comment. */ public boolean represents(Method aMethod) { if (aMethod != null) { if (isUnspecified() || typeClassImplementsInterface(aMethod.getJavaClass())) { if (isDefault()) return true; else if (getName().equals(aMethod.getName())) { if (hasMethodParams()) return matchesParams(aMethod); return true; } } } return false; } /**
/** * Return true if this MethodElement uniquely identifies * @aMethod. Return false, even if the MethodElement represents * @aMethod (i.e., @aMethod is contained in its list of methods). */ public boolean uniquelyIdentifies(Method aMethod) { if (aMethod != null) { if (getTypeJavaClass() != null && typeClassImplementsInterface(aMethod.getJavaClass()) && getName().equals(aMethod.getName())) { if (hasMethodParams()) return matchesParams(aMethod); return aMethod.listParametersWithoutReturn().length==0; } } return false; } /**
return null; } else if (obj instanceof Method) { return ((Method) obj).getJavaClass().getQualifiedName(); } else if (obj instanceof Field) { return ((Field) obj).getJavaClass().getQualifiedName();