Creates the appropriate BeanHelper for a property on a bean.
346261
private void doCreateHelperForProp(final PropertyDescriptor propertyDescriptor,
      final BeanHelper parent, final TreeLogger logger, final GeneratorContext context)
      throws UnableToCompleteException {
    final Class<?> elementClass = propertyDescriptor.getElementClass();
    if (GwtSpecificValidatorCreator.isIterableOrMap(elementClass)) {
      if (parent.hasField(propertyDescriptor)) {
        final JClassType type = parent.getAssociationType(propertyDescriptor, true);

        this.createHelper(type.getErasedType(), logger, context);
      }
      if (parent.hasGetter(propertyDescriptor)) {
        final JClassType type = parent.getAssociationType(propertyDescriptor, false);

        this.createHelper(type.getErasedType(), logger, context);
      }
    } else {
      if (serverSideValidator.getConstraintsForClass(elementClass).isBeanConstrained()) {
        this.createHelper(elementClass, logger, context);
      }
    }
  }
247826
public static Object getProperty(Object bean, List<String> propertyPath) {
		Object current = bean;
		for (String propertyName : propertyPath) {
			if (current == null) {
				return null;
			}
			if (current instanceof Iterable) {
				// follow multi-valued property
				List<Object> result = new ArrayList<>();
				Iterable<?> iterable = (Iterable<?>) current;
				for (Object currentElem : iterable) {
					result.add(getProperty(currentElem, propertyName));
				}
				current = result;
			} else {
				// follow single-valued property
				current = getProperty(current, propertyName);
			}
		}
		return current;
	}
1177306
protected void initialize() {
        this.mappedFields = new HashMap<String, PropertyDescriptor>();
        PropertyDescriptor[] pds = BeanUtils.getPropertyDescriptors(mappedClass);
        if (checkProperties) {
            mappedProperties = new HashSet<String>();
        }
        for (int i = 0; i < pds.length; i++) {
            PropertyDescriptor pd = pds[i];
            if (pd.getWriteMethod() != null) {
                if (checkProperties) {
                    this.mappedProperties.add(pd.getName());
                }
                this.mappedFields.put(pd.getName().toLowerCase(), pd);
                for (String underscoredName : underscoreName(pd.getName())) {
                    if (underscoredName != null
                            && !pd.getName().toLowerCase().equals(underscoredName)) {
                        this.mappedFields.put(underscoredName, pd);
                    }
                }
            }
        }
    }
244259
public static void setProperty(Object bean, String propertyName, Object value)
   {
	   setProperty(bean,propertyName,value,true);
   }
98188
public BeanType<ValidationMappingDescriptor> getOrCreateBean()
   {
      List<Node> nodeList = model.get("bean");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new BeanTypeImpl<ValidationMappingDescriptor>(this, "bean", model, nodeList.get(0));
      }
      return createBean();
   }
450969
public static void acceptVisitor(Object bean, JavaBeanVisitor visitor)
   {
	   
	   if(bean == null)
		   return;
	   
	   Class<?> beanClass = bean.getClass();
	   
	   if(ClassPath.isPrimitive(beanClass))
	   {
		   visitor.visitClass(beanClass, bean);
		   
		   return; //no properties
	   }
	   
 	  PropertyDescriptor descriptors[] = getPropertyDescriptors(bean);
       
       Object value = null;
       for(int i = 0; i < descriptors.length; i++)
       {
               String name = descriptors[i].getName();
               if("class".equals(name))
               {
                        visitor.visitClass((Class<?>)getProperty(bean, name),bean);
                        continue;
                        
               }
                
               if(descriptors[i].getReadMethod() != null)
               {
                  value = getProperty(bean, name);
                  
                 visitor.visitProperty(name, value,bean);                 
               }
                 
       }
 	  
   }
596438
public static Mapper beanMapper(final String property){
        return  new Mapper() {
        public Object map(Object a) {
            try {
                return BeanUtils.getProperty(a, property);
            } catch (Exception e) {
                throw new ClassCastException("Object was not the expected class: " + a.getClass());
            }
        }
        };
    }
690492
public static Object getProperty(Object bean, String expression) {
		return BeanPath.create(expression).get(bean);
	}
410882
@Bean
	@ConditionalOnMissingBean(DefaultAdvisorAutoProxyCreator.class)
	@ConditionalOnProperty(prefix = JavaMelodyConfigurationProperties.PREFIX, name = "advisor-auto-proxy-creator-enabled", matchIfMissing = false)
	public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() {
		return new DefaultAdvisorAutoProxyCreator();
	}
309755
protected PropertyMap getBeanAnnotationMap(ControlBean bean, AnnotatedElement annotElem)
    {
        PropertyMap map = new AnnotatedElementMap(annotElem);

        // REVIEW: is this the right place to handle the general control client case?
        if ( bean != null )
            setDelegateMap( map, bean, annotElem );

        return map;
    }
111846
public static void set(final Object bean, final String property, Object value) {

        try {
            if (property.indexOf(".") >= 0) {

                final String firstProperty = property.substring(0, property.indexOf("."));
                Object subBean = ClassMockUtils.get(bean, firstProperty);

                if (subBean == null) {

                    subBean = ClassMockUtils.getPropertyClass(bean.getClass(), firstProperty).newInstance();
                    ClassMockUtils.set(bean, firstProperty, subBean);
                }

                final String newProperty = property.substring(property.indexOf(".") + 1);
                ClassMockUtils.set(subBean, newProperty, value);

                return;
            }

            Method setterMethod = null;

            for (final Method method : bean.getClass().getMethods()) {

                if (method.getName().equals(ClassMockUtils.propertyToSetter(property))) {

                    setterMethod = method;
                    break;
                }
            }

            if (setterMethod != null) {

                final Class<?> type = setterMethod.getParameterTypes()[0];

                if (type == null) {

                    throw new RuntimeException("The setter method of " + property + " does not have a parameter.");

                } else if (type.isArray() && !type.getComponentType().isPrimitive()) {

                    final Object[] array = (Object[]) Array.newInstance(type.getComponentType(), ((Object[]) value).length);

                    for (int i = 0; i < array.length; i++) {

                        array[i] = type.getComponentType().cast(((Object[]) value)[i]);
                    }

                    setterMethod.invoke(bean, new Object[] { array });

                } else {

                    if ((value instanceof String) && ((type == Integer.class) || (type == int.class))) {
                        value = Integer.parseInt((String) value);
                    } else if ((value instanceof String) && ((type == Long.class) || (type == long.class))) {
                        value = Long.parseLong((String) value);
                    } else if ((value instanceof String) && ((type == Byte.class) || (type == byte.class))) {
                        value = Byte.parseByte((String) value);
                    } else if ((value instanceof String) && ((type == Short.class) || (type == short.class))) {
                        value = Short.parseShort((String) value);
                    } else if ((value instanceof String) && ((type == Float.class) || (type == float.class))) {
                        value = Float.parseFloat((String) value);
                    } else if ((value instanceof String) && ((type == Double.class) || (type == double.class))) {
                        value = Double.parseDouble((String) value);
                    } else if ((value instanceof String) && ((type == Boolean.class) || (type == boolean.class))) {
                        value = Boolean.parseBoolean((String) value);
                    }

                    setterMethod.invoke(bean, value);
                }
            }
        } catch (final Exception e) {

            throw new RuntimeException("Can't set property " + property + " in the class " + bean.getClass().getName());
        }
    }
252386
@Override
    public BeanBuilder<T> set(String propertyName, Object value) {
        return set(bean.metaBean().metaProperty(propertyName), value);
    }
945622
public static Class getPropertyType(Class<?> beanClass, String property){
        Method getter = getGetterMethod(beanClass, property);
        if(getter==null)
            return null;
        else
            return getter.getReturnType();
    }
1209115
protected final Object beanLookup(Object value, Object propertyName) {
        LOGGER.trace("get JavaBean property : " + propertyName);
        return ParseUtils.getProperty(value, propertyName.toString(), PROPERTY_CACHE);
    }
146903
private static List<PropertyDescriptor> getPropertyDescriptorsOptional(
        Class<?> beanClass)
    {
        BeanInfo beanInfo = getBeanInfoOptional(beanClass);
        if (beanInfo == null)
        {
            return Collections.emptyList();
        }
        PropertyDescriptor propertyDescriptors[] = 
            beanInfo.getPropertyDescriptors();
        if (propertyDescriptors == null)
        {
            return Collections.emptyList();
        }
        return Collections.unmodifiableList(
            new ArrayList<PropertyDescriptor>(
                Arrays.asList(propertyDescriptors)));
    }
1133258
public <T> WithStaticFinder<T> withFinder(Class<T> beanType) {
    WithStaticFinder<T> withFinder = new WithStaticFinder<>(beanType);
    staticFinderReplacement.add(withFinder);
    return withFinder;
  }
286732
@Override
    public BeanBuilder<B> set(String propertyName, Object value) {
        return set(metaBean.metaProperty(propertyName), value);
    }