protected List getMethodElementSignatures(List someMethods) { int size = someMethods.size(); List signatures = new ArrayList(size); Method method; for (int i = 0; i < size; i++) { method = (Method) someMethods.get(i); signatures.add(method.getMethodElementSignature()); } return signatures; } /**
/** * Return true if the method passed in is inherited from a parent in a * component inheritance hierarchy. */ protected boolean isComponentInherited(IEJBValidationContext vc, EnterpriseBean bean, JavaClass clazz, Method meth) throws InvalidInputException { if (componentParents == null) { // Not part of a component inheritance hierarchy return false; } return (componentParents.contains(meth.getContainingJavaClass())); }
public static final boolean isPublic( Method method ) { if ( method == null ) return false; return (JavaVisibilityKind.PUBLIC_LITERAL == method.getJavaVisibility()); }
public boolean isMethodType(EnterpriseBean bean, JavaClass clazz, Method method, List[] methodsExtendedLists) { if(method == null) { return false; } if(method.getName().equals(IMethodAndFieldConstants.METHODNAME_EJBACTIVATE)) { if(method.listParametersWithoutReturn().length == 0) { return true; } } return false; }
/** * Does the method name start with "get", and is the method a zero arg * method, that does not return void? */ protected static boolean isGetter(Method aMethod) { String name = aMethod.getName(); return name != null && name.startsWith(GET) && name.length() > 3 && aMethod.listParametersWithoutReturn().length==0 && !aMethod.isVoid(); }
/** * Checks to see if @ejbMethod is one of the required methods. */ protected void primValidateExistence(IEJBValidationContext vc, EnterpriseBean bean, JavaClass clazz, Method ejbMethod) throws InvalidInputException { // Can't invoke an abstract method //super.validateExistence(ejbMethod); if (ejbMethod.isConstructor()) { // These booleans are used in the validateMethodExists() checks. hasAConstructor = true; if (ValidationRuleUtility.isPublic(ejbMethod) && (ejbMethod.listParametersWithoutReturn().length == 0)) { hasDefaultConstructor = true; } } }
if (method.isVoid()) w.write("void "); else w.write(getFullyQualifiedName(method.getReturnType())); w.write(" "); w.write(method.getName()); w.write("("); JavaParameter[] inputParams = method.listParametersWithoutReturn(); for (int i = 0; i < inputParams.length; i++) List exceptions = method.getJavaExceptions(); if (!exceptions.isEmpty()) w.write(" throws "); decrementIndent(); newLine(w); if (!method.isVoid()) w.write("return "); w.write(stubName); w.write("."); w.write(method.getName()); w.write("("); for (int i = 0; i < inputParams.length; i++)
String name = ejbMethod.getName(); if (!hasSetEntityContext && name.equals(IMethodAndFieldConstants.METHODNAME_SETENTITYCONTEXT)) { JavaParameter[] params = ejbMethod.listParametersWithoutReturn(); if (params.length == 1) { if (ValidationRuleUtility.isAssignableFrom(params[0].getJavaType(), ValidationRuleUtility.getType(ITypeConstants.CLASSNAME_JAVAX_EJB_ENTITYCONTEXT, bean))) { if (ejbMethod.listParametersWithoutReturn().length == 0) { hasUnsetEntityContext = true; if (ejbMethod.listParametersWithoutReturn().length == 0) { hasEjbActivate = true; if (ejbMethod.listParametersWithoutReturn().length == 0) { hasEjbPassivate = true; if (ejbMethod.listParametersWithoutReturn().length == 0) { hasEjbRemove = true; if (ejbMethod.listParametersWithoutReturn().length == 0) { hasEjbLoad = true; if (ejbMethod.listParametersWithoutReturn().length == 0) { hasEjbStore = true; else if (!hasValidConstructor && ejbMethod.isConstructor()) { hasAConstructor = true; if (ValidationRuleUtility.isPublic(ejbMethod) && (ejbMethod.listParametersWithoutReturn().length == 0)) { hasValidConstructor = true;
public List getMethodElementSignatures(List methods) { List signatures, sameNames; sameNames = new ArrayList(); signatures = new ArrayList(methods.size() + 1); signatures.add(DEFAULT_METHOD_NAME); Iterator it = methods.iterator(); Method aMethod; String methodName; while (it.hasNext()) { aMethod = (Method) it.next(); methodName = aMethod.getName(); if (sameNames.contains(methodName)) { if (!signatures.contains(methodName)) signatures.add(methodName); } else sameNames.add(methodName); signatures.add(aMethod.getMethodElementSignature()); } Collections.sort(signatures); return signatures; } /**
protected static String getReturnTypeName(Method getter) { if (getter == null) return null; JavaHelpers retType = getter.getReturnType(); return getTypeName(retType); }
method = (Method) methods.get(i); method.isStatic(); if (method.getReturnType() != null) out.append(" " + method.getReturnType().getJavaName() + " "); else out.append(" void "); out.append(method.getName() + "("); EList parms = method.getParameters(); JavaParameter parm; if (parms.size() > 0) {
public String getMethodName(EnterpriseBean bean, JavaClass clazz, Method method) { if(method == null) { return ""; //$NON-NLS-1$ } return method.getName(); }
Method match = ValidationRuleUtility.getMethod(method, method.getName(), getBeanClassMethodsExtended(methodsExtendedLists)); if(match == null) { IMessage message = MessageUtility.getUtility().getMessage(vc, IEJBValidatorMessageConstants.CHKJ2023, IEJBValidationContext.WARNING, bean, clazz, method, new String[]{method.getMethodElementSignature(), bean.getEjbClass().getJavaName()}, this); vc.addMessage(message); if(!ValidationRuleUtility.isAssignableFrom(method.getReturnType(), match.getReturnType())) { IMessage message = MessageUtility.getUtility().getMessage(vc, IMessagePrefixEjb20Constants.CHKJ2470, IEJBValidationContext.ERROR, bean, clazz, method, new String[]{match.getReturnType().getJavaName()}, this); vc.addMessage(message); while(eiterator.hasNext()) { JavaClass exception = (JavaClass)eiterator.next(); IMessage message = MessageUtility.getUtility().getMessage(vc, IMessagePrefixEjb20Constants.CHKJ2471, IEJBValidationContext.WARNING, bean, clazz, method, new String[]{exception.getJavaName(), match.getMethodElementSignature()}, this); vc.addMessage(message);
public static final boolean usesLocalTypes(EnterpriseBean bean, Method method) { if((bean == null) || (method == null)) { return false; } JavaParameter[] parms = method.listParametersWithoutReturn(); if(parms != null) { for(int i=0; i<parms.length; i++) { JavaParameter parm = parms[i]; if(isLocalType(bean, parm.getJavaType())) { return true; } } } // Now check the return type if(isLocalType(bean, method.getReturnType())) { return true; } return false; } }
/** * Precondition: setter must take one parameter, and getter must return * a type, not void */ protected static boolean typesAgree(Method getter, Method setter) { if (getter == null || getter.isVoid() || setter == null) return false; JavaParameter[] parameters = setter.listParametersWithoutReturn(); if (parameters.length != 1) return false; JavaParameter param = parameters[0]; return param.getEType() != null && param.getEType() == getter.getReturnType(); }
/** * 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; } /**
/** * Checks to see if @ejbMethod is one of the required methods. */ protected void primValidateExistence(IEJBValidationContext vc, EnterpriseBean bean, JavaClass clazz, Method ejbMethod) throws InvalidInputException { // Can't invoke an abstract method //super.validateExistence(ejbMethod); if (IMethodAndFieldConstants.METHODNAME_EJBCREATE.equals(ejbMethod.getName())) incrementCreateMethodCount(vc, bean, clazz, ejbMethod); else if (ejbMethod.isConstructor()) validateConstructor(vc, bean, clazz, ejbMethod); }
private void writeSEIMethods(Writer w) throws IOException, CoreException { newLine(w); //WebServiceElement wse = WebServiceElement.getWebServiceElement(model_); if (clientProject_ == null) return;//wse.getProxyProject(); StringTokenizer st = new StringTokenizer(seis_.toString(), ";"); while (st.hasMoreTokens()) { String sei = st.nextToken(); JavaClass javaClass = JavaMOFUtils.getJavaClass(getPackageName(sei), getClassName(sei), clientProject_); if (javaClass != null) { List methods = javaClass.getMethods(); for (Iterator it = methods.iterator(); it.hasNext();) { Method method = (Method)it.next(); if (!method.isConstructor() && !method.isNative() && method.getJavaVisibility().getValue() == JavaVisibilityKind.PUBLIC) writeSEIMethods(w, javaClass, method); } } } }
if(method.isConstructor()) continue; tempMethods[j] = new BooleanSelection( method.getMethodElementSignature(), true); j++;
} else if (object instanceof Method) { Method method = (Method) object; JavaClass clazz = method.getContainingJavaClass(); return ResourceHandler.getExternalizedMessage(EJBHelperConstants.LOC_METHOD, new String[]{method.getMethodElementSignature(), clazz.getQualifiedName()}); } else if (object instanceof Field) { Field field = (Field) object;