Package jodd.introspector

Examples of jodd.introspector.MethodDescriptor


    String[] names = new String[propertyDescriptors.length];

    for (int i = 0; i < propertyDescriptors.length; i++) {
      PropertyDescriptor propertyDescriptor = propertyDescriptors[i];

      MethodDescriptor getter = propertyDescriptor.getReadMethodDescriptor();
      if (getter != null) {
        if (getter.matchDeclared(declared)) {
          names[i] = propertyDescriptor.getName();
        }
      }
    }
View Full Code Here


          throw new PetiteException(methods.length + " suitable methods found as injection points for: " + beanDefinition.type.getName() + '#' + methodName);
        }
        method = methods[0].getMethod();
      }
    } else {
      MethodDescriptor md = cd.getMethodDescriptor(methodName, arguments, true);
      if (md != null) {
        method = md.getMethod();
      }
    }
    if (method == null) {
      throw new PetiteException("Method not found: " + beanDefinition.type.getName() + '#' + methodName);
    }
View Full Code Here

    int total = initMethodNames.length;
    InitMethodPoint[] initMethodPoints = new InitMethodPoint[total];

    int i;
    for (i = 0; i < initMethodNames.length; i++) {
      MethodDescriptor md = cd.getMethodDescriptor(initMethodNames[i], ReflectUtil.NO_PARAMETERS, true);
      if (md == null) {
        throw new PetiteException("Init method not found: " + beanDefinition.type.getName() + '#' + initMethodNames[i]);
      }
      initMethodPoints[i] = new InitMethodPoint(md.getMethod(), i, invocationStrategy);
    }

    beanDefinition.addInitMethodPoints(initMethodPoints);
  }
View Full Code Here

    int total = destroyMethodNames.length;
    DestroyMethodPoint[] destroyMethodPoints = new DestroyMethodPoint[total];

    int i;
    for (i = 0; i < destroyMethodNames.length; i++) {
      MethodDescriptor md = cd.getMethodDescriptor(destroyMethodNames[i], ReflectUtil.NO_PARAMETERS, true);
      if (md == null) {
        throw new PetiteException("Destroy method not found: " + beanDefinition.type.getName() + '#' + destroyMethodNames[i]);
      }
      destroyMethodPoints[i] = new DestroyMethodPoint(md.getMethod());
    }

    beanDefinition.addDestroyMethodPoints(destroyMethodPoints);
  }
View Full Code Here

    }

    Class beanType = beanDefinition.type;

    ClassDescriptor cd = ClassIntrospector.lookup(beanType);
    MethodDescriptor md = cd.getMethodDescriptor(methodName, arguments, true);

    if (md == null) {
      throw new PetiteException("Provider method not found: " + methodName);
    }

    ProviderDefinition providerDefinition = new ProviderDefinition(providerName, beanName, md.getMethod());

    providers.put(providerName, providerDefinition);
  }
View Full Code Here

   * @param staticMethodName static method name
   * @param arguments method argument types, may be <code>null</code>
   */
  public void registerPetiteProvider(String providerName, Class type, String staticMethodName, Class[] arguments) {
    ClassDescriptor cd = ClassIntrospector.lookup(type);
    MethodDescriptor md = cd.getMethodDescriptor(staticMethodName, arguments, true);

    if (md == null) {
      throw new PetiteException("Provider method not found: " + staticMethodName);
    }

    ProviderDefinition providerDefinition = new ProviderDefinition(providerName, md.getMethod());

    providers.put(providerName, providerDefinition);
  }
View Full Code Here

  /**
   * Resolves action method for given string ane method name.
   */
  public Method resolveActionMethod(Class<?> actionClass, String methodName) {
    MethodDescriptor methodDescriptor = ClassIntrospector.lookup(actionClass).getMethodDescriptor(methodName, false);
    if (methodDescriptor == null) {
      throw new MadvocException("Action class '" + actionClass.getSimpleName() + "' doesn't have public method: " + methodName);
    }
    return methodDescriptor.getMethod();
  }
View Full Code Here

    if (fd != null) {
      Annotation[] annotations = fd.getField().getAnnotations();
      collectAnnotationChecks(annChecks, propertyDescriptor.getType(), propertyDescriptor.getName(), annotations);
    }

    MethodDescriptor md = propertyDescriptor.getReadMethodDescriptor();
    if (md != null) {
      Annotation[] annotations = md.getMethod().getAnnotations();
      collectAnnotationChecks(annChecks, propertyDescriptor.getType(), propertyDescriptor.getName(), annotations);
    }

    md = propertyDescriptor.getWriteMethodDescriptor();
    if (md != null) {
      Annotation[] annotations = md.getMethod().getAnnotations();
      collectAnnotationChecks(annChecks, propertyDescriptor.getType(), propertyDescriptor.getName(), annotations);
    }
  }
View Full Code Here

    ArrayList<String> realNames = new ArrayList<String>();

    JSONAnnotation jsonAnnotation = new JSONAnnotation(JoddJson.jsonAnnotation);

    for (PropertyDescriptor pd : pds) {
      MethodDescriptor md = pd.getReadMethodDescriptor();

      if (md != null) {
        Method getter = md.getMethod();
        JSONAnnotationData data = jsonAnnotation.readAnnotationData(getter);

        if (data == null) {
          FieldDescriptor fd = pd.getFieldDescriptor();
          if (fd == null) {
View Full Code Here

  /**
   * Resolves action method for given action class ane method name.
   */
  public Method resolveActionMethod(Class<?> actionClass, String methodName) {
    MethodDescriptor methodDescriptor = ClassIntrospector.lookup(actionClass).getMethodDescriptor(methodName, false);
    if (methodDescriptor == null) {
      throw new MadvocException("Public method not found: " + actionClass.getSimpleName() + "#" + methodName);
    }
    return methodDescriptor.getMethod();
  }
View Full Code Here

TOP

Related Classes of jodd.introspector.MethodDescriptor

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.