Package com.caucho.config.gen

Examples of com.caucho.config.gen.ApiMethod


                                           Class []param,
                                           ApiMethod sourceMethod,
                                           ApiClass sourceClass)
    throws ConfigException
  {
    ApiMethod method = null;
    ApiClass beanClass = getEJBClassWrapper();

    method = getMethod(beanClass, methodName, param);

    if (method == null && sourceMethod != null) {
      throw error(L.l("{0}: '{1}' expected to match {2}.{3}",
                      beanClass.getName(),
                      getFullMethodName(methodName, param),
                      sourceMethod.getDeclaringClass().getSimpleName(),
                      getFullMethodName(sourceMethod)));
    }
    else if (method == null) {
      throw error(L.l("{0}: '{1}' expected",
                      beanClass.getName(),
                      getFullMethodName(methodName, param)));
    }
    /*
      else if (Modifier.isAbstract(method.getModifiers()) &&
      getBeanManagedPersistence()) {
      throw error(L.l("{0}: '{1}' must not be abstract",
      beanClass.getName(),
      getFullMethodName(methodName, param)));
      }
    */
    else if (! method.isPublic()) {
      throw error(L.l("{0}: '{1}' must be public",
                      beanClass.getName(),
                      getFullMethodName(methodName, param)));
    }

    if (method.isStatic()) {
      throw error(L.l("{0}: '{1}' must not be static",
                      beanClass.getName(),
                      getFullMethodName(methodName, param)));
    }

    if (method.isFinal()) {
      throw error(L.l("{0}: '{1}' must not be final.",
                      beanClass.getName(),
                      getFullMethodName(methodName, param),
                      beanClass.getName()));
    }
View Full Code Here


           ApiMethod sourceMethod,
           ApiClass sourceClass,
           boolean isOptional)
    throws ConfigException
  {
    ApiMethod method = validateMethod(methodName, param,
              sourceMethod, sourceClass,
              isOptional);

    if (method == null && isOptional)
      return null;

    if (method.isFinal())
      throw error(L.l("{0}: '{1}' must not be final",
                      _ejbClass.getName(),
                      getFullMethodName(method)));


    if (method.isStatic())
      throw error(L.l("{0}: '{1}' must not be static",
                      _ejbClass.getName(),
                      getFullMethodName(method)));

    return method;
View Full Code Here

  protected ApiMethod validateMethod(String methodName, Class []param,
         ApiMethod sourceMethod, ApiClass sourceClass,
         boolean isOptional)
    throws ConfigException
  {
    ApiMethod method = null;

    method = getMethod(_ejbClass, methodName, param);

    if (method == null && isOptional)
      return null;

    if (method == null && sourceMethod != null) {
      throw error(L.l("{0}: missing '{1}' needed to match {2}.{3}",
                      _ejbClass.getName(),
                      getFullMethodName(methodName, param),
                      sourceClass.getSimpleName(),
                      getFullMethodName(sourceMethod)));
    }
    else if (method == null) {
      throw error(L.l("{0}: expected '{1}'",
                      _ejbClass.getName(),
                      getFullMethodName(methodName, param)));
    }

    ApiClass declaringClass = method.getDeclaringClass();

    if (method.isAbstract()) {
      if (method.getDeclaringClass().getName().equals("javax.ejb.EntityBean"))
        throw error(L.l("{0}: '{1}' must not be abstract.  Entity beans must implement the methods in EntityBean.",
                        _ejbClass.getName(),
                        getFullMethodName(methodName, param)));
      else if (method.getDeclaringClass().getName().equals("javax.ejb.SessionBean"))
        throw error(L.l("{0}: '{1}' must not be abstract.  Session beans must implement the methods in SessionBean.",
                        _ejbClass.getName(),
                        getFullMethodName(methodName, param)));
      else if (sourceMethod != null)
        throw error(L.l("{0}: '{1}' must not be abstract.  All methods from '{2}' must be implemented in the bean.",
                        _ejbClass.getName(),
                        getFullMethodName(methodName, param),
                        sourceClass.getName()));
      else
        throw error(L.l("{0}: '{1}' must not be abstract.  Business methods must be implemented.",
                        _ejbClass.getName(),
                        getFullMethodName(methodName, param)));
    } else if (! method.isPublic()) {
      throw error(L.l("{0}: '{1}' must be public.  Business method implementations must be public.",
                      _ejbClass.getName(),
                      getFullMethodName(methodName, param)));
    }
    if (method.isStatic()) {
      throw error(L.l("{0}: '{1}' must not be static.  Business method implementations must not be static.",
                      _ejbClass.getName(),
                      getFullMethodName(method)));
    }
View Full Code Here

            String name,
            Class []param)
  {
   
    for (int i = 0; i < apiList.size(); i++) {
      ApiMethod method = getMethod(apiList.get(i), name, param);

      if (method != null)
        return method;
    }
View Full Code Here

   */
  public static ApiMethod findMethod(ArrayList<ApiMethod> methods, ApiMethod method)
  {
    loop:
    for (int i = 0; i < methods.size(); i++) {
      ApiMethod oldMethod = methods.get(i);

      if (oldMethod.equals(method))
  return oldMethod;
    }

    return null;
  }
View Full Code Here

   * Tests is a method is declared in a class.
   */
  public boolean classHasMethod(ApiMethod method, ApiClass cl)
  {
    try {
      ApiMethod match = cl.getMethod(method.getName(),
             method.getParameterTypes());
      return match != null;
    } catch (Exception e) {
      return false;
    }
View Full Code Here

TOP

Related Classes of com.caucho.config.gen.ApiMethod

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.