Package jodd.introspector

Examples of jodd.introspector.PropertyDescriptor


    PropertyDescriptor[] propertyDescriptors = classDescriptor.getAllPropertyDescriptors();

    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();
        }
      }
    }

    return names;
View Full Code Here


        if (keyName.equals(classMetadataName)) {
          continue;
        }
      }

      PropertyDescriptor pd = cd.getPropertyDescriptor(keyName, declared);

      if (!targetIsMap && pd == null) {
        // target property does not exist, continue
        continue;
      }

      // value is one of JSON basic types, like Number, Map, List...
      Object value = map.get(key);

      Class propertyType = pd == null ? null : pd.getType();
      Class componentType = pd == null ? null : pd.resolveComponentType(true);

      if (value != null) {
        if (value instanceof List) {
          if (componentType != null && componentType != String.class) {
            value = generifyList((List) value, componentType);
          }
        }
        else if (value instanceof Map) {
          // if the value we want to inject is a Map...
          if (ReflectUtil.isTypeOf(propertyType, Map.class) == false) {
            // ... and if target is NOT a map
            value = map2bean((Map) value, propertyType);
          }
          else {
            // target is also a Map, but we might need to generify it
            Class keyType = pd == null ? null : pd.resolveKeyType(true);

            if (keyType != String.class || componentType != String.class) {
              // generify
              value = generifyMap((Map) value, keyType, componentType);
            }
View Full Code Here

      skipWhiteSpaces();

      // read the type of the simple property

      PropertyDescriptor pd = null;
      Class propertyType = null;
      Class keyType = null;
      Class componentType = null;

      // resolve simple property

      if (!isTargetRealTypeMap) {
        // replace key with real property value
        key = JoddJson.annotationManager.resolveRealName(targetType, key);
      }

      if (!isTargetTypeMap) {
        pd = targetTypeClassDescriptor.getPropertyDescriptor(key, true);

        if (pd != null) {
          propertyType = pd.getType();
          keyType = pd.resolveKeyType(true);
          componentType = pd.resolveComponentType(true);
        }
      }

      Object value;
View Full Code Here

  public void registerPetitePropertyInjectionPoint(String beanName, String property, String reference) {
    BeanDefinition beanDefinition = lookupExistingBeanDefinition(beanName);
    String[] references = reference == null ? null : new String[] {reference};

    ClassDescriptor cd = ClassIntrospector.lookup(beanDefinition.type);
    PropertyDescriptor propertyDescriptor = cd.getPropertyDescriptor(property, true);
    if (propertyDescriptor == null) {
      throw new PetiteException("Property not found: " + beanDefinition.type.getName() + '#' + property);
    }

    PropertyInjectionPoint pip =
View Full Code Here

   */
  public void registerPetiteSetInjectionPoint(String beanName, String property) {
    BeanDefinition beanDefinition = lookupExistingBeanDefinition(beanName);
    ClassDescriptor cd = ClassIntrospector.lookup(beanDefinition.type);

    PropertyDescriptor propertyDescriptor = cd.getPropertyDescriptor(property, true);

    if (propertyDescriptor == null) {
      throw new PetiteException("Property not found: " + beanDefinition.type.getName() + '#' + property);
    }

View Full Code Here

TOP

Related Classes of jodd.introspector.PropertyDescriptor

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.