常用工具类1

public static String beanPropertiesToString(Object bean, String... pros)
    {
        Class c = bean.getClass();
        StringBuffer buffer = new StringBuffer();
        buffer.append(c.getName() + '[');
        int i = 0;
        for (String string : pros)
        {
            try
            {
                Object properties = PropertyUtils.getProperty(bean, string);
                buffer.append(string);
                buffer.append('=');
                if (properties instanceof Object[])
                {
                    Object[] objs = (Object[])properties;
                    buffer.append(Tool.arrayToString(objs));
                }
                else
                {
                    buffer.append(properties);
                }
                if (++i < pros.length)
                {
                    buffer.append(',');
                }
            }
            catch (Exception e)
            {
                UspLog.error(e);
            }
        }
        buffer.append(']');
        return buffer.toString();
    }
   

你可能感兴趣的:(C++,c,bean,C#)