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

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

?? lazydynaclass.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;

/**
 * <p>DynaClass which implements the <code>MutableDynaClass</code> interface.</p>
 *
 * <p>A <code>MutableDynaClass</code> is a specialized extension to <code>DynaClass</code>
 *    that allows properties to be added or removed dynamically.</p>
 *
 * <p>This implementation has one slightly unusual default behaviour - calling
 *    the <code>getDynaProperty(name)</code> method for a property which doesn't
 *    exist returns a <code>DynaProperty</code> rather than <code>null</code>. The
 *    reason for this is that <code>BeanUtils</code> calls this method to check if
 *    a property exists before trying to set the value. This would defeat the object
 *    of the <code>LazyDynaBean</code> which automatically adds missing properties
 *    when any of its <code>set()</code> methods are called. For this reason the
 *    <code>isDynaProperty(name)</code> method has been added to this implementation
 *    in order to determine if a property actually exists. If the more <i>normal</i>
 *    behaviour of returning <code>null</code> is required, then this can be achieved
 *    by calling the <code>setReturnNull(true)</code>.</p>
 *
 * <p>The <code>add(name, type, readable, writable)</code> method is not implemented
 *    and always throws an <code>UnsupportedOperationException</code>. I believe
 *    this attributes need to be added to the <code>DynaProperty</code> class
 *    in order to control read/write facilities.</p>
 *
 * @see LazyDynaBean
 * @author Niall Pemberton
 */
public class LazyDynaClass extends BasicDynaClass implements MutableDynaClass  {

    /**
     * Controls whether changes to this DynaClass's properties are allowed.
     */
    protected boolean restricted;

    /**
     * <p>Controls whether the <code>getDynaProperty()</code> method returns
     * null if a property doesn't exist - or creates a new one.</p>
     *
     * <p>Default is <code>false</code>.
     */
    protected boolean returnNull = false;

    /**
     * Construct a new LazyDynaClass with default parameters.
     */
    public LazyDynaClass() {
        this(null, (DynaProperty[])null);
    }

    /**
     * Construct a new LazyDynaClass with the specified name.
     *
     * @param name Name of this DynaBean class
     */
    public LazyDynaClass(String name) {
        this(name, (DynaProperty[])null);
    }

    /**
     * Construct a new LazyDynaClass with the specified name and DynaBean class.
     *
     * @param name Name of this DynaBean class
     * @param dynaBeanClass The implementation class for new instances
     */
    public LazyDynaClass(String name, Class dynaBeanClass) {
        this(name, dynaBeanClass, null);
    }

    /**
     * Construct a new LazyDynaClass with the specified name and properties.
     *
     * @param name Name of this DynaBean class
     * @param properties Property descriptors for the supported properties
     */
    public LazyDynaClass(String name, DynaProperty[] properties) {
        this(name, LazyDynaBean.class, properties);
    }

    /**
     * Construct a new LazyDynaClass with the specified name, DynaBean class and properties.
     *
     * @param name Name of this DynaBean class
     * @param dynaBeanClass The implementation class for new intances
     * @param properties Property descriptors for the supported properties
     */
    public LazyDynaClass(String name, Class dynaBeanClass, DynaProperty properties[]) {
        super(name, dynaBeanClass, properties);
    }

    /**
     * <p>Is this DynaClass currently restricted.</p>
     * <p>If restricted, no changes to the existing registration of
     *  property names, data types, readability, or writeability are allowed.</p>
     * @return <code>true</code> if this {@link MutableDynaClass} cannot be changed
     * otherwise <code>false</code>
     */
    public boolean isRestricted() {
        return restricted;
    }

    /**
     * <p>Set whether this DynaClass is currently restricted.</p>
     * <p>If restricted, no changes to the existing registration of
     *  property names, data types, readability, or writeability are allowed.</p>
     * @param restricted <code>true</code> if this {@link MutableDynaClass} cannot
     * be changed otherwise <code>false</code>
     */
    public void setRestricted(boolean restricted) {
        this.restricted = restricted;
    }

    /**
     * Should this DynaClass return a <code>null</code> from
     * the <code>getDynaProperty(name)</code> method if the property
     * doesn't exist.
     *
     * @return <code>true<code> if a <code>null</code> {@link DynaProperty}
     * should be returned if the property doesn't exist, otherwise
     * <code>false</code> if a new {@link DynaProperty} should be created.
     */
    public boolean isReturnNull() {
        return returnNull;
    }

    /**
     * Set whether this DynaClass should return a <code>null</code> from
     * the <code>getDynaProperty(name)</code> method if the property
     * doesn't exist.
     * @param returnNull <code>true<code> if a <code>null</code> {@link DynaProperty}
     * should be returned if the property doesn't exist, otherwise
     * <code>false</code> if a new {@link DynaProperty} should be created.
     */
    public void setReturnNull(boolean returnNull) {
        this.returnNull = returnNull;
    }

    /**
     * Add a new dynamic property with no restrictions on data type,
     * readability, or writeability.
     *
     * @param name Name of the new dynamic property
     *
     * @exception IllegalArgumentException if name is null
     * @exception IllegalStateException if this DynaClass is currently
     *  restricted, so no new properties can be added
     */
    public void add(String name) {
        add(new DynaProperty(name));
    }

    /**
     * Add a new dynamic property with the specified data type, but with
     * no restrictions on readability or writeability.
     *
     * @param name Name of the new dynamic property
     * @param type Data type of the new dynamic property (null for no
     *  restrictions)
     *
     * @exception IllegalArgumentException if name is null
     * @exception IllegalStateException if this DynaClass is currently
     *  restricted, so no new properties can be added
     */
    public void add(String name, Class type) {
        if (type == null) {
            add(name);
        } else {
            add(new DynaProperty(name, type));
        }
    }

    /**
     * <p>Add a new dynamic property with the specified data type, readability,
     * and writeability.</p>
     *
     * <p><strong>N.B.</strong>Support for readable/writeable properties has not been implemented
     *    and this method always throws a <code>UnsupportedOperationException</code>.</p>
     *
     * <p>I'm not sure the intention of the original authors for this method, but it seems to
     *    me that readable/writable should be attributes of the <code>DynaProperty</code> class
     *    (which they are not) and is the reason this method has not been implemented.</p>
     *
     * @param name Name of the new dynamic property
     * @param type Data type of the new dynamic property (null for no
     *  restrictions)
     * @param readable Set to <code>true</code> if this property value
     *  should be readable
     * @param writeable Set to <code>true</code> if this property value
     *  should be writeable
     *
     * @exception UnsupportedOperationException anytime this method is called
     */
    public void add(String name, Class type, boolean readable, boolean writeable) {
        throw new java.lang.UnsupportedOperationException("readable/writable properties not supported");
    }

    /**
     * Add a new dynamic property.
     *
     * @param property Property the new dynamic property to add.
     *
     * @exception IllegalArgumentException if name is null
     * @exception IllegalStateException if this DynaClass is currently
     *  restricted, so no new properties can be added
     */
    protected void add(DynaProperty property) {

        if (property.getName() == null) {
            throw new IllegalArgumentException("Property name is missing.");
        }

        if (isRestricted()) {
            throw new IllegalStateException("DynaClass is currently restricted. No new properties can be added.");
        }

        // Check if property already exists
        if (propertiesMap.get(property.getName()) != null) {
           return;
        }

        // Create a new property array with the specified property
        DynaProperty[] oldProperties = getDynaProperties();
        DynaProperty[] newProperties = new DynaProperty[oldProperties.length+1];
        System.arraycopy(oldProperties, 0, newProperties, 0, oldProperties.length);
        newProperties[oldProperties.length] = property;

       // Update the properties
       setProperties(newProperties);

    }

    /**
     * Remove the specified dynamic property, and any associated data type,
     * readability, and writeability, from this dynamic class.
     * <strong>NOTE</strong> - This does <strong>NOT</strong> cause any
     * corresponding property values to be removed from DynaBean instances
     * associated with this DynaClass.
     *
     * @param name Name of the dynamic property to remove
     *
     * @exception IllegalArgumentException if name is null
     * @exception IllegalStateException if this DynaClass is currently
     *  restricted, so no properties can be removed
     */
    public void remove(String name) {

        if (name == null) {
            throw new IllegalArgumentException("Property name is missing.");
        }

        if (isRestricted()) {
            throw new IllegalStateException("DynaClass is currently restricted. No properties can be removed.");
        }

        // Ignore if property doesn't exist
        if (propertiesMap.get(name) == null) {
            return;
        }


        // Create a new property array of without the specified property
        DynaProperty[] oldProperties = getDynaProperties();
        DynaProperty[] newProperties = new DynaProperty[oldProperties.length-1];
        int j = 0;
        for (int i = 0; i < oldProperties.length; i++) {
            if (!(name.equals(oldProperties[i].getName()))) {
                newProperties[j] = oldProperties[i];
                j++;
            }
        }

        // Update the properties
        setProperties(newProperties);

    }

    /**
     * <p>Return a property descriptor for the specified property.</p>
     *
     * <p>If the property is not found and the <code>returnNull</code> indicator is
     *    <code>true</code>, this method always returns <code>null</code>.</p>
     *
     * <p>If the property is not found and the <code>returnNull</code> indicator is
     *    <code>false</code> a new property descriptor is created and returned (although
     *    its not actually added to the DynaClass's properties). This is the default
     *    beahviour.</p>
     *
     * <p>The reason for not returning a <code>null</code> property descriptor is that
     *    <code>BeanUtils</code> uses this method to check if a property exists
     *    before trying to set it - since these <i>Lazy</i> implementations automatically
     *    add any new properties when they are set, returning <code>null</code> from
     *    this method would defeat their purpose.</p>
     *
     * @param name Name of the dynamic property for which a descriptor
     *  is requested
     * @return The dyna property for the specified name
     *
     * @exception IllegalArgumentException if no property name is specified
     */
    public DynaProperty getDynaProperty(String name) {

        if (name == null) {
            throw new IllegalArgumentException("Property name is missing.");
        }

        DynaProperty dynaProperty = (DynaProperty)propertiesMap.get(name);

        // If it doesn't exist and returnNull is false
        // create a new DynaProperty
        if (dynaProperty == null && !isReturnNull() && !isRestricted()) {
            dynaProperty = new DynaProperty(name);
        }

        return dynaProperty;

    }

    /**
     * <p>Indicate whether a property actually exists.</p>
     *
     * <p><strong>N.B.</strong> Using <code>getDynaProperty(name) == null</code>
     * doesn't work in this implementation because that method might
     * return a DynaProperty if it doesn't exist (depending on the
     * <code>returnNull</code> indicator).</p>
     *
     * @param name The name of the property to check
     * @return <code>true<code> if there is a property of the
     * specified name, otherwise <code>false</code>
     * @exception IllegalArgumentException if no property name is specified
     */
    public boolean isDynaProperty(String name) {

        if (name == null) {
            throw new IllegalArgumentException("Property name is missing.");
        }

        return propertiesMap.get(name) ==  null ? false : true;

    }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜天堂影视香蕉久久| 久久久精品中文字幕麻豆发布| 国产精品综合网| 亚洲国产一区二区三区青草影视| 国产精品久久网站| 国产精品美女久久久久久| 国产无一区二区| 中文字幕av一区 二区| 久久在线观看免费| 久久久精品一品道一区| 国产网红主播福利一区二区| 久久久久久免费网| 国产精品天干天干在观线| 国产精品污污网站在线观看| 国产精品乱人伦| 亚洲精品中文字幕在线观看| 亚洲大片在线观看| 日韩av电影免费观看高清完整版| 天堂av在线一区| 黑人巨大精品欧美一区| 国产精品一二三四区| 成人免费的视频| 色一区在线观看| 欧美精品久久一区二区三区| 欧美精品一区二区三区久久久| 久久久不卡网国产精品二区| 亚洲日本va午夜在线影院| 偷拍与自拍一区| 免费国产亚洲视频| 高清不卡一区二区| 欧美性色aⅴ视频一区日韩精品| 欧美嫩在线观看| 欧美变态凌虐bdsm| 国产精品久久久99| 日韩电影一二三区| eeuss鲁一区二区三区| 欧美日韩一区久久| 国产亚洲欧美一级| 亚洲成人福利片| 成人网页在线观看| 欧美精品xxxxbbbb| 亚洲精品国产精华液| 久久国产日韩欧美精品| 色成年激情久久综合| 久久久久亚洲蜜桃| 午夜久久久影院| gogo大胆日本视频一区| 精品久久人人做人人爽| 一区二区久久久久久| 成人久久18免费网站麻豆| 欧美一区二区三区免费在线看| 国产精品五月天| 国产精品一区二区久激情瑜伽| 欧美三级中文字| 自拍偷拍欧美精品| 国产一区二区视频在线播放| 欧美巨大另类极品videosbest | 99精品欧美一区二区三区小说| 欧美日韩一区久久| 一区二区在线免费| 99精品视频中文字幕| 国产性色一区二区| 国产在线乱码一区二区三区| 6080日韩午夜伦伦午夜伦| 自拍偷拍国产精品| 91小视频在线| 国产精品欧美极品| 丁香婷婷综合五月| 国产婷婷一区二区| 蜜桃91丨九色丨蝌蚪91桃色| 日韩一区二区三| 五月天视频一区| 欧美网站一区二区| 亚洲精品日韩专区silk| 国产99一区视频免费| 精品美女一区二区三区| 蜜桃传媒麻豆第一区在线观看| 欧美综合天天夜夜久久| 中文av一区二区| 白白色亚洲国产精品| 国产精品视频一二三区| 韩国欧美一区二区| 日韩美女天天操| 国产一区二区影院| 中文无字幕一区二区三区| www.亚洲精品| 一区二区日韩av| 91国偷自产一区二区三区成为亚洲经典 | 久久嫩草精品久久久精品| 精品一区二区在线免费观看| 5566中文字幕一区二区电影| 秋霞影院一区二区| 欧美变态口味重另类| 极品尤物av久久免费看| 日韩欧美不卡在线观看视频| 久久精品99国产精品日本| 精品国产网站在线观看| 国模无码大尺度一区二区三区 | 国产suv精品一区二区883| 国产欧美精品日韩区二区麻豆天美| 国产一区二区三区精品视频| 国产精品萝li| 在线成人高清不卡| 久久99国产精品免费网站| 精品久久人人做人人爰| 国产在线不卡视频| 中文字幕第一页久久| 一本大道久久a久久综合婷婷| 午夜精品福利一区二区蜜股av| 欧美精品一区二区三区在线播放| 风流少妇一区二区| 日韩中文欧美在线| 久久久99久久精品欧美| 色素色在线综合| 国产精品综合视频| 亚洲成人动漫在线免费观看| 国产色一区二区| 欧美高清www午色夜在线视频| 国产电影精品久久禁18| 一二三区精品视频| 国产精品污www在线观看| 欧美一区二区视频在线观看2020| 福利视频网站一区二区三区| 免费观看成人av| 亚洲国产人成综合网站| 国产精品沙发午睡系列990531| 欧美军同video69gay| av福利精品导航| 九色综合国产一区二区三区| 亚洲在线观看免费| 欧美国产97人人爽人人喊| 欧美一区二区三区在线观看视频| 成人aa视频在线观看| 国产福利不卡视频| 亚洲成人av在线电影| 国产精品久久看| 日韩精品一区二区三区swag| 91.麻豆视频| 在线观看日韩毛片| 91麻豆精品在线观看| av在线综合网| 成人免费毛片片v| 国产成人亚洲综合a∨猫咪| 免费成人深夜小野草| 午夜视频在线观看一区| 亚洲成人免费在线观看| 国产精品盗摄一区二区三区| 国产欧美日韩久久| 国产亚洲综合在线| 久久精品亚洲麻豆av一区二区 | 国产午夜精品福利| 欧美精品一区二区三区视频| 91精品国产色综合久久| 欧美人与性动xxxx| 欧美美女直播网站| 欧美一区二区三区四区五区| 91麻豆精品国产91| 欧美一区二区三区视频免费| 91精品国产全国免费观看| 日韩一区二区三区视频在线| 日韩欧美一级二级| 2021国产精品久久精品| 日韩欧美一级特黄在线播放| 欧美大片免费久久精品三p| 精品少妇一区二区三区视频免付费 | 国内成人精品2018免费看| 日韩不卡一二三区| 午夜影院久久久| 日韩激情一二三区| 免费欧美高清视频| 麻豆一区二区99久久久久| 国产精品77777| 成人h动漫精品一区二区| 国产在线播精品第三| 国产在线乱码一区二区三区| 不卡的av电影在线观看| 日本韩国欧美国产| 在线成人免费观看| 国产欧美日韩精品一区| 亚洲午夜精品在线| 国产乱码字幕精品高清av| www.激情成人| 日韩一区二区三区观看| 国产精品嫩草影院av蜜臀| 亚洲人成伊人成综合网小说| 亚洲午夜精品久久久久久久久| 另类调教123区| hitomi一区二区三区精品| 欧美美女一区二区在线观看| 国产日韩欧美在线一区| 一区二区三区在线观看网站| 日韩电影免费在线| 成人avav在线| 26uuu国产电影一区二区| 伊人色综合久久天天人手人婷| 国产一区二区三区精品欧美日韩一区二区三区 | 国产三级欧美三级日产三级99| 亚洲色图清纯唯美| 蜜桃av噜噜一区二区三区小说| 91玉足脚交白嫩脚丫在线播放|