In order to reduce the amount of property data stored, we convert the
properties into a String matrix. The first element is the property name
followed by its values.

@param bean Bean to lookup properties from.
@return String matrix
199680
public static String[][] getProperties(final Bean bean) {
        final List<String> propertyNames = bean.getPropertyNames();
        final int psize = propertyNames.size();
        final String[][] properties = new String[psize][];
        for (int i = 0; i < psize; i++) {
            final String propertyName = propertyNames.get(i);
            final List<String> values = bean.getValues(propertyName);
            final int vsize = values.size();
            properties[i] = new String[vsize + 1];
            properties[i][0] = propertyName;
            for (int j = 0; j < vsize; j++) {
                properties[i][j + 1] = values.get(j);
            }
        }
        return properties;
    }
1109528
@SuppressWarnings("unchecked")
   public static <T> T getProperty(Object bean, String name)
       throws SystemException
   {
      try
      {
         return (T)getNestedProperty(bean, name);  
      }
      catch (Exception e)
      {
        throw new SystemException("Get property \""+name+"\" ERROR:"+e.getMessage(),e);
      }
   }
865909
private static PropertyDescriptor getPropertyDescriptorOptional(
        Class<?> beanClass, String propertyName)
    {
        List<PropertyDescriptor> propertyDescriptors = 
            getPropertyDescriptorsOptional(beanClass);
        for (PropertyDescriptor propertyDescriptor : propertyDescriptors)
        {
            if (propertyDescriptor.getName().equals(propertyName))
            {
                return propertyDescriptor;
            }
        }
        return null;
    }
1136048
private static PropertyDescriptor[][] getBeanProperties(Class<?> beanType) {
        List<PropertyDescriptor> readProperties = 
            new ArrayList<PropertyDescriptor>();
        
        List<PropertyDescriptor> writeProperties = 
            new ArrayList<PropertyDescriptor>();

        try {
            Map<?, ?> map = CompleteIntrospector.getAllProperties(beanType);

            Iterator<?> it = map.values().iterator();
            while (it.hasNext()) {
                PropertyDescriptor pd = (PropertyDescriptor)it.next();
                if (pd.getReadMethod() != null) {
                    readProperties.add(pd);
                }
                if (pd.getWriteMethod() != null) {
                    writeProperties.add(pd);
                }
            }
        }
        catch (IntrospectionException e) {
            throw new RuntimeException(e.toString());
        }

        PropertyDescriptor[][] props = new PropertyDescriptor[2][];

        props[0] = new PropertyDescriptor[readProperties.size()];
        readProperties.toArray(props[0]);
        props[1] = new PropertyDescriptor[writeProperties.size()];
        writeProperties.toArray(props[1]);

        return props;
    }
256998
private static String convertToBeanName(final String methodName)
   {
      return Character.toLowerCase(methodName.charAt(3)) + methodName.substring(4);
   }
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;
	}
918399
public static List<String> getFindedAllSensitive(Object bean){
		return sensitiveTree.matchAll(JSONUtil.toJsonStr(bean));
	}
591666
private static PropertyDescriptor[] getPropertyDescriptors(Object bean)
   {
       if(bean == null)
           throw new IllegalArgumentException("No bean specified");
       else
           return getPropertyDescriptors(bean.getClass());
   }
454307
public static String convertPropertyName(String prop) {
        if (Character.isDigit(prop.charAt(0))) {
            return prop;
        }
        return BeanUtils.decapitalize(prop);
    }
883379
public static Property getProperty(Bean bean, String propertyPattern) {
        if (propertyPattern == null) {
            throw new IllegalArgumentException("Cannot get a property with a 'null' propertyPattern.");
        }

        // '.' position if positive, '[' inverse position if negative
        int position = indexOfDotOrSquare(propertyPattern);

        // (propertyPattern.contains("."))
        if (position > 0) {
            String leftPattern = propertyPattern.substring(0, position);
            String rightPattern = propertyPattern.substring(position + 1, propertyPattern.length());
            Property leftProperty = bean.getProperty(leftPattern);

            return (leftProperty != null) ? getProperty(Bean.forClass(leftProperty.getType()), rightPattern) : null;
            // if (propertyPattern.contains("["))
        } else if (position < 0) {
            throw new IllegalArgumentException("The indexed or mapped '[]' notation is not allowed while searching" +
                                                       " a property, but '" + propertyPattern + "' pattern found.");
        }

        return bean.getProperty(propertyPattern);
    }
891467
public static Map<String, Object> beanToMap(Object bean) {
		return beanToMap(bean, false, false);
	}
1035264
public String stringify() {
        if (type == TokenType.TEXT) {
            return defaultValue;
        }
        StringBuilder sb = new StringBuilder();
        if (type == TokenType.BEAN) {
            sb.append(BEAN_SYMBOL);
            sb.append(START_BRACKET);
            if (name != null) {
                sb.append(name);
            }
            if (value != null) {
                sb.append(VALUE_SEPARATOR);
                sb.append(value);
            }
            if (getterName != null) {
                sb.append(GETTER_SEPARATOR);
                sb.append(getterName);
            }
        } else if (type == TokenType.TEMPLATE) {
            sb.append(TEMPLATE_SYMBOL);
            sb.append(START_BRACKET);
            if (name != null) {
                sb.append(name);
            }
        } else if (type == TokenType.PARAMETER) {
            sb.append(PARAMETER_SYMBOL);
            sb.append(START_BRACKET);
            if (name != null) {
                sb.append(name);
            }
        } else if (type == TokenType.ATTRIBUTE) {
            sb.append(ATTRIBUTE_SYMBOL);
            sb.append(START_BRACKET);
            if (name != null) {
                sb.append(name);
            }
            if (getterName != null) {
                sb.append(GETTER_SEPARATOR);
                sb.append(getterName);
            }
        } else if (type == TokenType.PROPERTY) {
            sb.append(PROPERTY_SYMBOL);
            sb.append(START_BRACKET);
            if (name != null) {
                sb.append(name);
            }
            if (value != null) {
                sb.append(VALUE_SEPARATOR);
                sb.append(value);
            }
            if (getterName != null) {
                sb.append(GETTER_SEPARATOR);
                sb.append(getterName);
            }
        } else {
            throw new InvalidTokenException("Unknown token type: " + type, this);
        }
        if (defaultValue != null) {
            sb.append(VALUE_SEPARATOR);
            sb.append(defaultValue);
        }
        sb.append(END_BRACKET);
        return sb.toString();
    }
219376
private String getConnectionFactoryName(String beanName) {
		if (beanName.length() > CONNECTION_FACTORY_SUFFIX.length()
				&& StringUtils.endsWithIgnoreCase(beanName, CONNECTION_FACTORY_SUFFIX)) {
			return beanName.substring(0,
					beanName.length() - CONNECTION_FACTORY_SUFFIX.length());
		}
		return beanName;
	}
349995
private List getFormBeanNames(TypeDeclaration beanType)
    {
        List formBeans = _strutsApp.getMatchingFormBeans(beanType, null);
        List formBeanNames = new ArrayList();

        for ( Iterator i = formBeans.iterator(); i.hasNext(); )
        {
            FormBeanModel formBeanModel = ( FormBeanModel ) i.next();
            formBeanNames.add( formBeanModel.getName() );
        }

        return formBeanNames;
    }
832904
public static final Class[] getParameterTypes(Object bean, String property)
    {
        Type type = (Type) doFor(
            bean, 
            property, 
            null,
            (Object a, int i)->{Object o = Array.get(a, i);return o!=null?o.getClass().getComponentType():null;},
            (List l, int i)->{return l.get(i).getClass().getGenericSuperclass();},
            (Object o, Class c, String p)->{return getField(c, p).getGenericType();}, 
            (Object o, Method m)->{return m.getGenericReturnType();});
        if (type instanceof ParameterizedType)
        {
            ParameterizedType pt = (ParameterizedType) type;
            Type[] ata = pt.getActualTypeArguments();
            if (ata.length > 0)
            {
                Class[] ca = new Class[ata.length];
                for (int ii=0;ii<ca.length;ii++)
                {
                    ca[ii] = (Class) ata[ii];
                }
                return ca;
            }
        }
        if (type instanceof Class)
        {
            Class cls = (Class) type;
            if (cls.isArray())
            {
                cls = cls.getComponentType();
            }
            return new Class[] {cls};
        }
        return null;
    }
281437
public void setReferencesOn(Bean bean) {
        for (KeyValue ref : references.values()) {
            final byte[] sidpid = ref.getQualifier();
            final byte[] iids = ref.getValue();
            final byte[] sid = new byte[] { sidpid[0], sidpid[1] };
            final byte[] pid = new byte[] { sidpid[2], sidpid[3] };

            final String schemaName = uids.getUsid().getName(sid);
            final String propertyName = uids.getUsid().getName(pid);

            for (int i = 0; i < iids.length; i += IID_WIDTH) {
                final byte[] iid = new byte[] { iids[i], iids[i + 1], iids[i + 2], iids[i + 3] };
                final String instanceId = uids.getUiid().getName(iid);
                bean.addReference(propertyName, BeanId.create(instanceId, schemaName));
            }
        }
    }
109917
protected void autowireBean(String beanName, BeanDefinition mbd, BindRegistry registry) {
    Map<String, Class<?>> properties = unsatisfiedNonSimpleProperties(mbd);
    for (Map.Entry<String, Class<?>> entry : properties.entrySet()) {
      String propertyName = entry.getKey();
      Class<?> propertyType = entry.getValue();
      List<String> beanNames = registry.getBeanNames(propertyType);
      List<String> innerNames = CollectUtils.newArrayList();
      for (String n : beanNames) {
        if (n.contains("#")) innerNames.add(n);
      }
      beanNames.removeAll(innerNames);
      boolean binded = false;
      if (beanNames.size() == 1) {
        mbd.getPropertyValues().add(propertyName, new RuntimeBeanReference(beanNames.get(0)));
        binded = true;
      } else if (beanNames.size() > 1) {
        // first autowire by primary
        for (String name : beanNames) {
          if (registry.isPrimary(name)) {
            mbd.getPropertyValues().add(propertyName, new RuntimeBeanReference(name));
            binded = true;
            break;
          }
        }
        // second autowire by name
        if (!binded) {
          for (String name : beanNames) {
            if (name.equals(propertyName)) {
              mbd.getPropertyValues().add(propertyName, new RuntimeBeanReference(name));
              binded = true;
              break;
            }
          }
        }
      }
      if (!binded) {
        if (beanNames.isEmpty()) {
          logger.debug("{}'s {} cannot found candidate beans.", beanName, propertyName);
        } else {
          logger.warn("{}'s {} expected single bean but found {} : {}",
              new Object[] { beanName, propertyName, beanNames.size(), beanNames });
        }
      }
    }
  }