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

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

?? dynaproperty.java

?? 這是一個有關common beanutils 的源碼
?? JAVA
字號:
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


package org.apache.commons.beanutils;


import java.io.IOException;
import java.io.Serializable;
import java.io.ObjectOutputStream;
import java.io.ObjectInputStream;
import java.io.StreamCorruptedException;
import java.util.List;
import java.util.Map;


/**
 * <p>The metadata describing an individual property of a DynaBean.</p>
 *
 * <p>The meta contains an <em>optional</em> content type property ({@link #getContentType})
 * for use by mapped and iterated properties. 
 * A mapped or iterated property may choose to indicate the type it expects.
 * The DynaBean implementation may choose to enforce this type on its entries.
 * Alternatively, an implementatin may choose to ignore this property.
 * All keys for maps must be of type String so no meta data is needed for map keys.</p>
 *
 * @author Craig R. McClanahan
 * @version $Revision: 555824 $ $Date: 2007-07-13 01:27:15 +0100 (Fri, 13 Jul 2007) $
 */

public class DynaProperty implements Serializable {

    // ----------------------------------------------------------- Constants
    
    /*
     * There are issues with serializing primitive class types on certain JVM versions
     * (including java 1.3).
     * This class uses a custom serialization implementation that writes an integer
     * for these primitive class.
     * This list of constants are the ones used in serialization.
     * If these values are changed, then older versions will no longer be read correctly
     */
    private static final int BOOLEAN_TYPE = 1;
    private static final int BYTE_TYPE = 2;
    private static final int CHAR_TYPE = 3;
    private static final int DOUBLE_TYPE = 4;
    private static final int FLOAT_TYPE = 5;
    private static final int INT_TYPE = 6;
    private static final int LONG_TYPE = 7;
    private static final int SHORT_TYPE = 8;
    

    // ----------------------------------------------------------- Constructors


    /**
     * Construct a property that accepts any data type.
     *
     * @param name Name of the property being described
     */
    public DynaProperty(String name) {

        this(name, Object.class);

    }


    /**
     * Construct a property of the specified data type.
     *
     * @param name Name of the property being described
     * @param type Java class representing the property data type
     */
    public DynaProperty(String name, Class type) {

        super();
        this.name = name;
        this.type = type;
        if (type != null && type.isArray()) {
            this.contentType = type.getComponentType();
        }

    }
    
    /**
     * Construct an indexed or mapped <code>DynaProperty</code> that supports (pseudo)-introspection
     * of the content type.
     *
     * @param name Name of the property being described
     * @param type Java class representing the property data type
     * @param contentType Class that all indexed or mapped elements are instances of
     */
    public DynaProperty(String name, Class type, Class contentType) {

        super();
        this.name = name;
        this.type = type;
        this.contentType = contentType;
        
    }

    // ------------------------------------------------------------- Properties

    /** Property name */
    protected String name = null;
    /**
     * Get the name of this property.
     * @return the name of the property
     */
    public String getName() {
        return (this.name);
    }
    
    /** Property type */
    protected transient Class type = null;
    /**
     * <p>Gets the Java class representing the data type of the underlying property
     * values.</p>
     * 
     * <p>There are issues with serializing primitive class types on certain JVM versions
     * (including java 1.3).
     * Therefore, this field <strong>must not be serialized using the standard methods</strong>.</p>
     * 
     * <p><strong>Please leave this field as <code>transient</code></strong></p>
     *
     * @return the property type
     */
    public Class getType() {
        return (this.type);
    }
    
    
    /** The <em>(optional)</em> type of content elements for indexed <code>DynaProperty</code> */
    protected transient Class contentType;
    /**
     * Gets the <em>(optional)</em> type of the indexed content for <code>DynaProperty</code>'s
     * that support this feature.
     *
     * <p>There are issues with serializing primitive class types on certain JVM versions
     * (including java 1.3).
     * Therefore, this field <strong>must not be serialized using the standard methods</strong>.</p>
     *
     * @return the Class for the content type if this is an indexed <code>DynaProperty</code> 
     * and this feature is supported. Otherwise null.
     */
    public Class getContentType() {
        return contentType;
    }
    
    // --------------------------------------------------------- Public Methods


    /**
     * Does this property represent an indexed value (ie an array or List)?
     *
     * @return <code>true</code> if the property is indexed (i.e. is a List or
     * array), otherwise <code>false</code>
     */
    public boolean isIndexed() {

        if (type == null) {
            return (false);
        } else if (type.isArray()) {
            return (true);
        } else if (List.class.isAssignableFrom(type)) {
            return (true);
        } else {
            return (false);
        }

    }


    /**
     * Does this property represent a mapped value (ie a Map)?
     *
     * @return <code>true</code> if the property is a Map
     * otherwise <code>false</code>
     */
    public boolean isMapped() {

        if (type == null) {
            return (false);
        } else {
            return (Map.class.isAssignableFrom(type));
        }

    }

    /**
     * Checks this instance against the specified Object for equality. Overrides the
     * default refererence test for equality provided by {@link java.lang.Object#equals(Object)}  
     * @param obj The object to compare to
     * @return <code>true</code> if object is a dyna property with the same name
     * type and content type, otherwise <code>false</code>
     */
    public boolean equals(final Object obj) {

        boolean result = false;

        result = (obj == this);

        if ((!result) && obj instanceof DynaProperty) {
            final DynaProperty that = (DynaProperty) obj;
            result = 
               ((this.name == null) ? (that.name == null) : (this.name.equals(that.name))) &&
               ((this.type == null) ? (that.type == null) : (this.type.equals(that.type))) &&
               ((this.contentType == null) ? (that.contentType == null) : (this.contentType.equals(that.contentType)));
        }

        return result;
    }

    /**
     * @return the hashcode for this dyna property
     * @see java.lang.Object#hashCode
     */
    public int hashCode() {

       int result = 1;
       
       result = result * 31 + ((name == null) ? 0 : name.hashCode());
       result = result * 31 + ((type == null) ? 0 : type.hashCode());
       result = result * 31 + ((contentType == null) ? 0 : contentType.hashCode());

       return result;
    }

    /**
     * Return a String representation of this Object.
     * @return a String representation of the dyna property
     */
    public String toString() {

        StringBuffer sb = new StringBuffer("DynaProperty[name=");
        sb.append(this.name);
        sb.append(",type=");
        sb.append(this.type);
        if (isMapped() || isIndexed()) {
            sb.append(" <").append(this.contentType).append(">");
        }
        sb.append("]");
        return (sb.toString());

    }

    // --------------------------------------------------------- Serialization helper methods
    
    /**
     * Writes this object safely.
     * There are issues with serializing primitive class types on certain JVM versions
     * (including java 1.3).
     * This method provides a workaround.
     */
    private void writeObject(ObjectOutputStream out) throws IOException {
        
        writeAnyClass(this.type,out);
        
        if (isMapped() || isIndexed()) {
            writeAnyClass(this.contentType,out);
        }
        
        // write out other values
        out.defaultWriteObject();
    }

    /**
     * Write a class using safe encoding to workaround java 1.3 serialization bug.
     */
    private void writeAnyClass(Class clazz, ObjectOutputStream out) throws IOException {
        // safely write out any class
        int primitiveType = 0;
        if (Boolean.TYPE.equals(clazz)) {
            primitiveType = BOOLEAN_TYPE;
        } else if (Byte.TYPE.equals(clazz)) {
            primitiveType = BYTE_TYPE;
        } else if (Character.TYPE.equals(clazz)) {
            primitiveType = CHAR_TYPE;
        } else if (Double.TYPE.equals(clazz)) {
            primitiveType = DOUBLE_TYPE;
        } else if (Float.TYPE.equals(clazz)) {
            primitiveType = FLOAT_TYPE;
        } else if (Integer.TYPE.equals(clazz)) {
            primitiveType = INT_TYPE;
        } else if (Long.TYPE.equals(clazz)) {
            primitiveType = LONG_TYPE;
        } else if (Short.TYPE.equals(clazz)) {
            primitiveType = SHORT_TYPE;
        }
        
        if (primitiveType == 0) {
            // then it's not a primitive type
            out.writeBoolean(false);
            out.writeObject(clazz);
        } else {
            // we'll write out a constant instead
            out.writeBoolean(true);
            out.writeInt(primitiveType);
        }
    }
    
    /**
     * Reads field values for this object safely.
     * There are issues with serializing primitive class types on certain JVM versions
     * (including java 1.3).
     * This method provides a workaround.
     *
     * @throws StreamCorruptedException when the stream data values are outside expected range 
     */
    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
        
        this.type = readAnyClass(in);
        
        if (isMapped() || isIndexed()) {
            this.contentType = readAnyClass(in);
        }
        
        // read other values
        in.defaultReadObject();
    }
    

    /**
     * Reads a class using safe encoding to workaround java 1.3 serialization bug.
     */
    private Class readAnyClass(ObjectInputStream in) throws IOException, ClassNotFoundException {
        // read back type class safely 
        if (in.readBoolean()) {
            // it's a type constant
            switch (in.readInt()) {
            
                case BOOLEAN_TYPE: return   Boolean.TYPE;
                case BYTE_TYPE:    return      Byte.TYPE;
                case CHAR_TYPE:    return Character.TYPE;
                case DOUBLE_TYPE:  return    Double.TYPE;
                case FLOAT_TYPE:   return     Float.TYPE;
                case INT_TYPE:     return   Integer.TYPE;
                case LONG_TYPE:    return      Long.TYPE;
                case SHORT_TYPE:   return     Short.TYPE;
                default:
                    // something's gone wrong
                    throw new StreamCorruptedException(
                        "Invalid primitive type. "
                        + "Check version of beanutils used to serialize is compatible.");

            }
              
        } else {
            // it's another class
            return ((Class) in.readObject());
        }
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品一区二区三区影院| 91在线观看污| 精品1区2区在线观看| 婷婷中文字幕综合| 日韩成人一区二区| 国产一区二区主播在线| 国产一区二区三区在线观看免费视频 | 亚洲一区二区三区四区在线观看| 自拍偷拍亚洲综合| 一区二区三区四区国产精品| 日本欧美一区二区| 欧美www视频| 亚洲综合在线观看视频| 欧美写真视频网站| 91麻豆精品国产91久久久久久 | 欧美日韩午夜在线视频| 欧美tickle裸体挠脚心vk| 久久99国产精品久久| www.欧美精品一二区| 91麻豆精品国产自产在线观看一区| 午夜婷婷国产麻豆精品| 精品国产露脸精彩对白| av成人免费在线观看| 午夜不卡av免费| 国产欧美一区二区精品秋霞影院| 亚洲视频一二三| 91 com成人网| av高清不卡在线| 另类人妖一区二区av| 国产xxx精品视频大全| 不卡高清视频专区| 久久精品水蜜桃av综合天堂| 久久91精品久久久久久秒播| 亚洲卡通动漫在线| 成人国产精品免费观看视频| 午夜天堂影视香蕉久久| 国产精品久久久久久久第一福利| 美女高潮久久久| 久久综合九色综合97婷婷 | 亚洲免费色视频| 91免费观看视频在线| 国产精品一卡二卡| 欧美激情一区在线观看| 成人午夜电影久久影院| 一区二区三区成人在线视频| 国产女人18毛片水真多成人如厕| 日韩欧美成人午夜| 国产成人福利片| 亚洲最新视频在线观看| 亚洲美女视频一区| 亚洲特级片在线| 亚洲少妇中出一区| 亚洲黄网站在线观看| 亚洲黄色小说网站| 手机精品视频在线观看| 日韩欧美国产wwwww| 日韩一区二区三区高清免费看看| 精品一区二区三区在线观看国产| 亚洲成人一区二区在线观看| 日韩女优av电影在线观看| 日韩一区二区三区免费看 | 亚洲乱码国产乱码精品精小说 | 人禽交欧美网站| 精品女同一区二区| 久久久精品免费网站| 欧美色倩网站大全免费| 欧美人伦禁忌dvd放荡欲情| 国产高清不卡一区| 高清久久久久久| 日韩欧美国产一区在线观看| 2020日本不卡一区二区视频| 国产精品久久精品日日| 亚洲中国最大av网站| 六月丁香婷婷色狠狠久久| 国产在线国偷精品产拍免费yy| 国产xxx精品视频大全| 日本久久电影网| 成人综合在线观看| 日韩午夜激情av| 一区二区免费在线| 国产精品一级黄| 9191成人精品久久| 国产精品久久久久永久免费观看| 亚洲va欧美va人人爽| 国产成人精品免费看| 日韩一区二区精品在线观看| 国产精品电影一区二区三区| 裸体健美xxxx欧美裸体表演| 91免费版在线| 国产精品国产自产拍高清av| 美国毛片一区二区三区| 欧美日韩免费一区二区三区| 亚洲欧美日韩在线不卡| 国产一区二区日韩精品| 日韩欧美综合在线| 日韩成人免费在线| 91精品蜜臀在线一区尤物| 一区二区高清在线| 欧洲激情一区二区| 欧美性猛交一区二区三区精品| 亚洲人成网站影音先锋播放| 风间由美一区二区av101| 久久久国产午夜精品| 黑人精品欧美一区二区蜜桃| 国产盗摄女厕一区二区三区 | 色88888久久久久久影院野外| 国产精品毛片高清在线完整版| 中文字幕一区二区三区蜜月| 国产精品久久夜| 91国偷自产一区二区三区成为亚洲经典 | 色吊一区二区三区| 亚洲www啪成人一区二区麻豆| 精品视频全国免费看| 日本欧洲一区二区| 欧美mv日韩mv亚洲| 成人听书哪个软件好| 亚洲免费观看在线视频| 日韩一区二区免费视频| 高清国产一区二区| 亚洲激情在线激情| 精品国产污网站| 国产精品高清亚洲| 午夜伊人狠狠久久| 亚洲国产一二三| 中文字幕在线不卡视频| 在线中文字幕不卡| 国产一区二区三区四| 午夜精品一区二区三区免费视频| 久久免费美女视频| 日韩三级高清在线| 欧美亚洲精品一区| av电影在线观看一区| 国产精品一二三在| 麻豆视频观看网址久久| 亚洲成av人片一区二区| 中文字幕不卡在线播放| 欧美tk丨vk视频| 91精品麻豆日日躁夜夜躁| 欧美中文字幕一区二区三区| 成人午夜大片免费观看| www.欧美日韩| av不卡一区二区三区| 成人av网站在线观看| 国产精品亚洲人在线观看| 裸体健美xxxx欧美裸体表演| 蜜臀91精品一区二区三区| 久久精品国产一区二区| 美美哒免费高清在线观看视频一区二区| 一区二区三区四区精品在线视频| 亚洲视频一区二区在线观看| 国产精品久久久久aaaa樱花| 亚洲激情图片小说视频| 午夜欧美大尺度福利影院在线看 | 911精品国产一区二区在线| 91精品国产乱| 国产成人自拍在线| 成人v精品蜜桃久久一区| 国产成人精品aa毛片| 在线免费观看日韩欧美| 91精品国模一区二区三区| 精品成人在线观看| 中文字幕日韩一区| 亚洲影院理伦片| 国产一区二区调教| 91黄色在线观看| 久久综合色播五月| 亚洲精品成人在线| 久久99久国产精品黄毛片色诱| 国产成人在线影院| 欧美日韩一区成人| 中文乱码免费一区二区| 天堂一区二区在线| 成av人片一区二区| 欧美一二三区在线观看| 亚洲一区二区三区视频在线| 精品影院一区二区久久久| 欧美专区日韩专区| 国产精品久久三| 国产精品综合网| 日韩三级中文字幕| 性久久久久久久久久久久| 91在线精品一区二区| 欧美国产精品中文字幕| 韩国成人在线视频| 日韩一区二区三区电影| 人人爽香蕉精品| 欧美电影一区二区| 久久综合久久综合亚洲| 视频在线在亚洲| 日韩午夜av一区| 看电影不卡的网站| 欧美一区二区免费观在线| 日韩精品一级中文字幕精品视频免费观看| eeuss鲁片一区二区三区在线看| 国产亚洲欧洲997久久综合| 国产精品夜夜嗨| 中文字幕亚洲欧美在线不卡| 9人人澡人人爽人人精品| 亚洲欧洲日韩一区二区三区| 91丝袜呻吟高潮美腿白嫩在线观看|