亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? beanutils.java

?? Jive論壇2.5版本的源程序
?? JAVA
字號:
/**
 * $RCSfile: BeanUtils.java,v $
 * $Revision: 1.1.1.1 $
 * $Date: 2002/09/09 13:51:09 $
 *
 * New Jive  from Jdon.com.
 *
 * This software is the proprietary information of CoolServlets, Inc.
 * Use is subject to license terms.
 */

package com.jivesoftware.util;

import com.jivesoftware.forum.util.*;

import java.beans.*;
import java.awt.Color;
import java.util.*;

/**
 * A utility class that provides methods that are useful for dealing with
 * Java Beans.
 */
public class BeanUtils {

    /**
     * Sets the properties of a Java Bean based on the String name/value pairs in
     * the specifieed Map. Because this method has to know how to convert a
     * String value into the correct type for the bean, only a few bean property
     * types are supported. They are: String, boolean, int, long, float, double,
     * Color, and Class.<p>
     *
     * If key/value pairs exist in the Map that don't correspond to properties
     * of the bean, they will be ignored.
     *
     * @param bean the JavaBean to set properties on.
     * @param properties String name/value pairs of the properties to set.
     */
    public static void setProperties(Object bean, Map properties) {
        try {
            // Loop through all the property names in the Map
            for (Iterator iter = properties.keySet().iterator(); iter.hasNext();) {
                String propName = (String)iter.next();
                try {
                    // Create a property descriptor for the named property. If
                    // the bean doesn't have the named property, an
                    // Introspection will be thrown.
                    PropertyDescriptor descriptor = new PropertyDescriptor(
                            propName, bean.getClass());
                    // Load the class type of the property.
                    Class propertyType = descriptor.getPropertyType();
                    // Get the value of the property by converting it from a
                    // String to the correct object type.
                    Object value = decode(propertyType, (String)properties.get(propName));
                    // Set the value of the bean.
                    descriptor.getWriteMethod().invoke(bean, new Object[] { value });
                }
                catch (IntrospectionException ie) {
                    // Ignore. This exception means that the key in the map
                    // does not correspond to a property of the bean.
                }
            }
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * Gets the properties from a Java Bean and returns them in a Map of String
     * name/value pairs. Because this method has to know how to convert a
     * bean property into a String value, only a few bean property
     * types are supported. They are: String, boolean, int, long, float, double,
     * Color, and Class.
     *
     * @param bean a Java Bean to get properties from.
     * @return a Map of all properties as String name/value pairs.
     */
    public static Map getProperties(Object bean) {
        Map properties = new HashMap();
        try {
            BeanInfo beanInfo = Introspector.getBeanInfo(bean.getClass());
            // Loop through all properties of the bean.
            PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
            String [] names = new String[descriptors.length];
            for (int i=0; i<names.length; i++) {
                // Determine the property name.
                String name = descriptors[i].getName();
                Class type = descriptors[i].getPropertyType();
                // Decode the property value using the property type and
                // encoded String value.
                Object value = descriptors[i].getReadMethod().invoke(bean, null);
                // Add to Map, encoding the value as a String.
                properties.put(name, encode(value));
            }
        }
        catch (Exception e) {
            e.printStackTrace();
        }
        return properties;
    }

    /**
     * Returns the PropertyDescriptor array for the specified Java Bean Class.
     * The method also does a special check to see of the bean has a BeanInfo
     * class that extends the JiveBeanInfo class. If yes, we load the
     * PropertyDescriptor array directly from that BeanInfo class rather than
     * through the Introspector in order to preserve the desired ordering of
     * properties.
     *
     * @param beanClass the Class of the JavaBean.
     * @return the PropertyDescriptor array for the specified Java Bean Class.
     */
    public static PropertyDescriptor[] getPropertyDescriptors(Class beanClass)
            throws IntrospectionException
    {
        // See if the Java Bean has a BeanInfo class that implements
        // JiveBeanInfo. If so, return the PropertyDescriptor from that
        // class. This will bypass properties of parent classes, but this is
        // the normal behavior of classes that implement JiveBeanInfo.
        try {
            JiveBeanInfo beanInfo = (JiveBeanInfo)Class.forName(
                    beanClass.getName() + "BeanInfo").newInstance();
            return beanInfo.getPropertyDescriptors();
        }
        catch (Exception e) { }
        // Otherwise, return the PropertyDescriptors from the Introspector.
        return Introspector.getBeanInfo(beanClass).getPropertyDescriptors();
    }

    /**
     * Encodes a bean property value as a String. If the object type is not
     * supported, null will be returned.
     *
     * @param value an Object to encode in a String representation.
     */
    private static String encode(Object value) {
        if (value instanceof String) {
            return (String)value;
        }
        if (value instanceof Boolean ||
            value instanceof Integer ||
            value instanceof Long ||
            value instanceof Float ||
            value instanceof Double)
        {
            return value.toString();
        }
        if (value instanceof Color) {
            Color color = (Color)value;
            return color.getRed() +","+ color.getGreen() +","+ color.getBlue();
        }
        if (value instanceof Class) {
            return ((Class)value).getName();
        }
        return null;
    }

    /**
     * Decodes a String into an object of the specified type. If the object
     * type is not supported, null will be returned.
     *
     * @paran type the type of the property.
     * @param the encode String value to decode.
     * @return the String value decoded into the specified type.
     */
    private static Object decode(Class type, String value) throws Exception {
        if (type.getName().equals("java.lang.String")) {
            return value;
        }
        if (type.getName().equals("boolean")) {
            return Boolean.valueOf(value);
        }
        if (type.getName().equals("int")) {
            return Integer.valueOf(value);
        }
        if (type.getName().equals("long")) {
            return Long.valueOf(value);
        }
        if (type.getName().equals("float")) {
            return Float.valueOf(value);
        }
        if (type.getName().equals("double")) {
            return Double.valueOf(value);
        }
        if (type.getName().equals("java.awt.Color")) {
            StringTokenizer tokens = new StringTokenizer(value, ",");
            int red = Integer.parseInt(tokens.nextToken());
            int green = Integer.parseInt(tokens.nextToken());
            int blue = Integer.parseInt(tokens.nextToken());
            return new Color(red, green, blue);
        }
        if (type.getName().equals("java.lang.Class")) {
            return Class.forName(value);
        }
        return null;
    }

    // This class is not instantiable.
    private BeanUtils() {
        // do nothing.
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一级二级三级乱码| 91丨九色porny丨蝌蚪| 91精品国产入口| 免费在线视频一区| 日韩女同互慰一区二区| 国内精品免费**视频| 久久久久久影视| 成人激情免费电影网址| 亚洲精品综合在线| 欧美老女人在线| 激情欧美一区二区| 国产精品久久久久久久岛一牛影视 | 色婷婷激情久久| 亚洲午夜电影在线观看| 日韩精品一区二区三区swag| 激情欧美一区二区三区在线观看| 国产欧美va欧美不卡在线 | 91在线国产观看| 亚洲国产成人porn| 精品久久久久久最新网址| 国产v综合v亚洲欧| 一级特黄大欧美久久久| 日韩欧美二区三区| av一区二区三区在线| 午夜精品视频在线观看| 久久女同精品一区二区| 一本色道久久综合精品竹菊| 日韩激情一二三区| 国产精品丝袜91| 欧美猛男超大videosgay| 国产高清一区日本| 午夜久久久久久久久久一区二区| 久久久久久亚洲综合影院红桃| 91啪九色porn原创视频在线观看| 日日噜噜夜夜狠狠视频欧美人| 国产亚洲欧洲一区高清在线观看| 91久久国产最好的精华液| 精品午夜久久福利影院| 亚洲人xxxx| 久久久久久久网| 欧美日韩精品一区视频| 成人免费电影视频| 蜜桃视频一区二区| 亚洲在线中文字幕| 国产精品青草综合久久久久99| 欧美一卡二卡三卡四卡| 日本高清视频一区二区| 国产乱一区二区| 五月天欧美精品| 亚洲人吸女人奶水| 久久久99精品久久| 欧美tickling网站挠脚心| 欧美系列一区二区| 成人av网址在线观看| 国产麻豆成人精品| 久久99精品国产麻豆不卡| 午夜精品免费在线| 一级做a爱片久久| 亚洲品质自拍视频网站| 欧美激情资源网| 精品欧美一区二区三区精品久久| 欧美人与z0zoxxxx视频| 色综合久久88色综合天天6| 成人午夜av在线| 国产成人综合亚洲网站| 国产制服丝袜一区| 蜜桃一区二区三区在线观看| 日韩在线播放一区二区| 天天做天天摸天天爽国产一区| 亚洲一区二区成人在线观看| 亚洲精品国产视频| 亚洲欧美激情插 | 蜜臀91精品一区二区三区| 五月综合激情网| 亚洲不卡在线观看| 亚洲福利一区二区三区| 亚洲国产精品嫩草影院| 亚洲大片精品永久免费| 五月开心婷婷久久| 日韩国产欧美三级| 青青草91视频| 狠狠色丁香久久婷婷综| 韩日精品视频一区| 国产激情精品久久久第一区二区 | 蜜臀av性久久久久蜜臀av麻豆| 日精品一区二区| 免费美女久久99| 激情综合网激情| 高清久久久久久| 色综合天天综合狠狠| 欧美图区在线视频| 欧美大片一区二区| 欧美激情一区在线| 亚洲欧美激情一区二区| 偷拍一区二区三区四区| 奇米777欧美一区二区| 韩国三级中文字幕hd久久精品| 风间由美一区二区三区在线观看 | 精品国产一二三| 久久久久亚洲蜜桃| 亚洲三级免费观看| 婷婷综合另类小说色区| 狠狠色狠狠色综合日日91app| 波波电影院一区二区三区| 91麻豆福利精品推荐| 欧美高清性hdvideosex| 精品国产一区二区三区久久影院| 亚洲国产高清不卡| 亚洲一区二区三区四区的| 欧美aⅴ一区二区三区视频| 国产精品一二三区在线| 在线免费视频一区二区| 日韩女优av电影| 亚洲女子a中天字幕| 秋霞影院一区二区| 成人天堂资源www在线| 欧美喷水一区二区| 国产精品久久久久久妇女6080| 午夜影视日本亚洲欧洲精品| 国产风韵犹存在线视精品| 在线亚洲人成电影网站色www| 日韩欧美中文字幕精品| 国产精品不卡视频| 免费一区二区视频| 91在线视频在线| 久久一日本道色综合| 亚洲午夜国产一区99re久久| 国产凹凸在线观看一区二区| 91精品国产美女浴室洗澡无遮挡| 国产精品欧美一级免费| 日韩成人免费电影| 972aa.com艺术欧美| 国产视频一区不卡| 奇米在线7777在线精品| 波多野结衣精品在线| 日韩精品一区二区三区中文精品| 亚洲欧美二区三区| 国产精品自拍一区| 欧美高清dvd| 亚洲蜜臀av乱码久久精品| 国产一区二区三区香蕉| 欧美一区二区三区日韩| 亚洲精品亚洲人成人网| 成人福利视频在线| 精品免费国产二区三区| 日韩和欧美一区二区三区| 成人激情图片网| 国产农村妇女精品| 久久超级碰视频| 欧美日韩精品系列| 一区二区三区不卡在线观看 | 久久久精品黄色| 日本亚洲欧美天堂免费| 欧美色爱综合网| 亚洲黄色av一区| 一本色道久久综合狠狠躁的推荐| 国产精品久久久一本精品| 国产风韵犹存在线视精品| 精品国产乱码91久久久久久网站| 天天综合网 天天综合色| 91福利区一区二区三区| 亚洲精品国产a| 色呦呦日韩精品| 亚洲人成7777| 91福利在线播放| 亚洲图片自拍偷拍| 欧美综合一区二区三区| 亚洲国产欧美一区二区三区丁香婷| 欧洲一区在线电影| 亚洲综合999| 欧美日韩精品欧美日韩精品一 | 色狠狠综合天天综合综合| 亚洲视频一二区| 91黄色免费看| 午夜精品久久久久久久99樱桃 | 国产成人精品www牛牛影视| 久久先锋影音av鲁色资源| 国产一区二区91| 国产色综合久久| av一区二区三区在线| 一区二区高清视频在线观看| 欧美三级中文字| 免费看日韩a级影片| 精品播放一区二区| 高清视频一区二区| 一区二区理论电影在线观看| 777欧美精品| 国产一区二区三区蝌蚪| 中文字幕va一区二区三区| 色综合天天视频在线观看| 亚洲第一成人在线| 欧美成人精品高清在线播放 | 日本韩国一区二区三区视频| 午夜影院久久久| 精品成人一区二区三区四区| 粉嫩嫩av羞羞动漫久久久| 亚洲激情综合网| 欧美一区二区三区免费在线看| 国产一区二区三区免费在线观看| 国产精品国产自产拍高清av王其|