Package jodd.introspector

Examples of jodd.introspector.MethodDescriptor


    this.type = resolveSetType(propertyDescriptor);

    // resolve component type
    Class targetClass = null;

    MethodDescriptor writeMethodDescriptor = propertyDescriptor.getWriteMethodDescriptor();
    FieldDescriptor fieldDescriptor = propertyDescriptor.getFieldDescriptor();

    if (writeMethodDescriptor != null) {
      targetClass = writeMethodDescriptor.getSetterRawComponentType();
    }
    if (targetClass == null && fieldDescriptor != null) {
      targetClass = fieldDescriptor.getRawComponentType();
    }
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

      Class propertyType = propertyDescriptor.getType();
      if (ReflectUtil.isTypeOf(propertyType, Collection.class)) {
        continue;
      }

      MethodDescriptor writeMethodDescriptor = propertyDescriptor.getWriteMethodDescriptor();
      FieldDescriptor fieldDescriptor = propertyDescriptor.getFieldDescriptor();

      PetiteInject ref = null;

      if (writeMethodDescriptor != null) {
        ref = writeMethodDescriptor.getMethod().getAnnotation(PetiteInject.class);
      }
      if (ref == null && fieldDescriptor != null) {
        ref = fieldDescriptor.getField().getAnnotation(PetiteInject.class);
      }
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

      Class propertyType = propertyDescriptor.getType();
      if (!ReflectUtil.isTypeOf(propertyType, Collection.class)) {
        continue;
      }

      MethodDescriptor writeMethodDescriptor = propertyDescriptor.getWriteMethodDescriptor();
      FieldDescriptor fieldDescriptor = propertyDescriptor.getFieldDescriptor();

      PetiteInject ref = null;

      if (writeMethodDescriptor != null) {
        ref = writeMethodDescriptor.getMethod().getAnnotation(PetiteInject.class);
      }
      if (ref == null && fieldDescriptor != null) {
        ref = fieldDescriptor.getField().getAnnotation(PetiteInject.class);
      }
View Full Code Here

    PropertyDescriptor[] propertyDescriptors = classDescriptor.getAllPropertyDescriptors();

    ArrayList<String> names = new ArrayList<String>(propertyDescriptors.length);

    for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
      MethodDescriptor getter = propertyDescriptor.getReadMethodDescriptor();
      if (getter != null) {
        if (getter.matchDeclared(declared)) {
          names.add(propertyDescriptor.getName());
        }
      }
      else if (includeFields) {
        FieldDescriptor field = propertyDescriptor.getFieldDescriptor();
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.