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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? beancomparator.java

?? 這是一個有關(guān)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.lang.reflect.InvocationTargetException;
import java.io.Serializable;
import java.util.Comparator;
import org.apache.commons.collections.comparators.ComparableComparator;

/**
 * <p>
 * This comparator compares two beans by the specified bean property. 
 * It is also possible to compare beans based on nested, indexed, 
 * combined, mapped bean properties. Please see the {@link PropertyUtilsBean} 
 * documentation for all property name possibilities. 
 *
 * </p><p>
 * <strong>Note:</strong> The BeanComparator passes the values of the specified 
 * bean property to a ComparableComparator, if no comparator is 
 * specified in the constructor. If you are comparing two beans based 
 * on a property that could contain "null" values, a suitable <code>Comparator</code> 
 * or <code>ComparatorChain</code> should be supplied in the constructor. 
 * </p>
 *
 * @author     <a href"mailto:epugh@upstate.com">Eric Pugh</a>
 * @author Tim O'Brien 
 */
public class BeanComparator implements Comparator, Serializable {

    private String property;
    private Comparator comparator;

    /** 
     * <p>Constructs a Bean Comparator without a property set.
     * </p><p>
     * <strong>Note</strong> that this is intended to be used 
     * only in bean-centric environments.
     * </p><p>
     * Until {@link #setProperty} is called with a non-null value.
     * this comparator will compare the Objects only.
     * </p>
     */
    public BeanComparator() {
        this( null );
    }

    /**
     * <p>Constructs a property-based comparator for beans.
     * This compares two beans by the property 
     * specified in the property parameter. This constructor creates 
     * a <code>BeanComparator</code> that uses a <code>ComparableComparator</code>
     * to compare the property values. 
     * </p>
     * 
     * <p>Passing "null" to this constructor will cause the BeanComparator 
     * to compare objects based on natural order, that is 
     * <code>java.lang.Comparable</code>. 
     * </p>
     *
     * @param property String Name of a bean property, which may contain the 
     * name of a simple, nested, indexed, mapped, or combined 
     * property. See {@link PropertyUtilsBean} for property query language syntax. 
     * If the property passed in is null then the actual objects will be compared
     */
    public BeanComparator( String property ) {
        this( property, ComparableComparator.getInstance() );
    }

    /**
     * Constructs a property-based comparator for beans.
     * This constructor creates 
     * a BeanComparator that uses the supplied Comparator to compare 
     * the property values. 
     * 
     * @param property Name of a bean property, can contain the name 
     * of a simple, nested, indexed, mapped, or combined 
     * property. See {@link PropertyUtilsBean} for property query language  
     * syntax. 
     * @param comparator BeanComparator will pass the values of the 
     * specified bean property to this Comparator. 
     * If your bean property is not a comparable or 
     * contains null values, a suitable comparator 
     * may be supplied in this constructor.
     */
    public BeanComparator( String property, Comparator comparator ) {
        setProperty( property );
        if (comparator != null) {
            this.comparator = comparator;
        } else {
            this.comparator = ComparableComparator.getInstance();
        }
    }

    /**
     * Sets the method to be called to compare two JavaBeans
     *
     * @param property String method name to call to compare 
     * If the property passed in is null then the actual objects will be compared
     */
    public void setProperty( String property ) {
        this.property = property;
    }


    /**
     * Gets the property attribute of the BeanComparator
     *
     * @return String method name to call to compare. 
     * A null value indicates that the actual objects will be compared
     */
    public String getProperty() {
        return property;
    }


    /**
     * Gets the Comparator being used to compare beans.
     *
     * @return the Comparator being used to compare beans 
     */
    public Comparator getComparator() {
        return comparator;
    }


    /**
     * Compare two JavaBeans by their shared property.
     * If {@link #getProperty} is null then the actual objects will be compared.
     *
     * @param  o1 Object The first bean to get data from to compare against
     * @param  o2 Object The second bean to get data from to compare
     * @return int negative or positive based on order
     */
    public int compare( Object o1, Object o2 ) {
        
        if ( property == null ) {
            // compare the actual objects
            return comparator.compare( o1, o2 );
        }
        
        try {
            Object value1 = PropertyUtils.getProperty( o1, property );
            Object value2 = PropertyUtils.getProperty( o2, property );
            return comparator.compare( value1, value2 );
        }
        catch ( IllegalAccessException iae ) {
            throw new RuntimeException( "IllegalAccessException: " + iae.toString() );
        } 
        catch ( InvocationTargetException ite ) {
            throw new RuntimeException( "InvocationTargetException: " + ite.toString() );
        }
        catch ( NoSuchMethodException nsme ) {
            throw new RuntimeException( "NoSuchMethodException: " + nsme.toString() );
        } 
    }
    
    /**
     * Two <code>BeanComparator</code>'s are equals if and only if
     * the wrapped comparators and the property names to be compared
     * are equal.
     * @param  o Comparator to compare to
     * @return whether the the comparators are equal or not
     */
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof BeanComparator)) {
            return false;
        }

        final BeanComparator beanComparator = (BeanComparator) o;

        if (!comparator.equals(beanComparator.comparator)) {
            return false;
        }
        if (property != null)
        {
            if (!property.equals(beanComparator.property)) {
                return false;
            }
        }
        else
        {
            return (beanComparator.property == null);
        }

        return true;
    }

    /**
     * Hashcode compatible with equals.
     * @return the hash code for this comparator
     */ 
    public int hashCode() {
        int result;
        result = comparator.hashCode();
        return result;
    }
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色久优优欧美色久优优| bt7086福利一区国产| 亚洲高清在线精品| 国产凹凸在线观看一区二区| 91精品国产综合久久精品app| 久久成人精品无人区| 国模娜娜一区二区三区| 亚洲精选免费视频| 久久99国产精品久久99果冻传媒| 蜜臀国产一区二区三区在线播放| 国产99久久久久| 国产欧美一区二区精品性色| 亚洲成人久久影院| 亚洲精品久久久久久国产精华液| 欧美日韩国产系列| 免费黄网站欧美| 奇米888四色在线精品| 在线中文字幕不卡| 亚洲丝袜美腿综合| 成年人网站91| 国产在线视频一区二区| 国产精一品亚洲二区在线视频| 亚洲成人动漫av| 裸体一区二区三区| 国产精品中文字幕日韩精品 | 成人性生交大片免费 | 91精品国产免费| 免费观看30秒视频久久| 床上的激情91.| 91在线国产福利| 国产精品综合在线视频| 国产欧美综合色| 国产精品国产三级国产普通话99 | 久久国产生活片100| 在线观看日韩高清av| caoporn国产一区二区| 91一区二区三区在线观看| 日韩理论片网站| 日韩国产成人精品| 国产精品一线二线三线| 午夜精品免费在线| 99re热这里只有精品视频| 91免费看片在线观看| 天堂蜜桃91精品| 色乱码一区二区三区88| 欧美午夜电影网| 久久久五月婷婷| 亚洲午夜久久久久中文字幕久| 日韩欧美一区在线| 日韩一区中文字幕| 日韩女优毛片在线| 亚洲欧美电影院| 国产成人免费视频网站 | 中文字幕综合网| 久久99精品久久久久| 欧美二区三区的天堂| 欧美怡红院视频| 91蝌蚪porny| 免费视频一区二区| 免费观看30秒视频久久| 欧美大白屁股肥臀xxxxxx| 国产目拍亚洲精品99久久精品| 日韩视频在线你懂得| 日韩一区二区影院| 激情五月播播久久久精品| 一区二区三区不卡视频| 蜜桃久久久久久| 波多野结衣在线一区| 2022国产精品视频| 五月婷婷久久丁香| 亚洲一级在线观看| 日本美女一区二区三区| 午夜精品久久久久影视| 日产精品久久久久久久性色| 成人免费看黄yyy456| 日韩免费在线观看| 国产成人午夜高潮毛片| 国产精品二三区| 国产精品免费丝袜| 中文字幕乱码日本亚洲一区二区 | 久久精品一区二区三区不卡 | 欧美国产一区在线| 久久99日本精品| 日韩视频在线一区二区| 麻豆91精品视频| 国产一区二区三区在线观看免费 | 久久亚区不卡日本| 午夜视频一区在线观看| 精品视频色一区| 欧美一区二区免费观在线| 亚洲狠狠爱一区二区三区| 91色综合久久久久婷婷| 丁香婷婷综合五月| 成人欧美一区二区三区黑人麻豆 | 精品久久久久久久久久久久包黑料 | 在线免费观看日本欧美| 欧美一区二区三区的| 亚洲精品一区二区三区在线观看 | 91在线观看下载| 亚洲va欧美va天堂v国产综合| 欧美日韩另类一区| 国产在线国偷精品产拍免费yy| 欧美极品美女视频| 国产精品一区在线观看乱码| 久久久久高清精品| 日韩专区中文字幕一区二区| 91丨九色丨国产丨porny| 成人涩涩免费视频| 国产露脸91国语对白| 欧美在线观看一区| 国产亚洲欧美中文| 国产99久久久国产精品免费看| 久久久久久久综合色一本| 日本免费在线视频不卡一不卡二| 欧美精品久久99| 欧美三级在线播放| 欧美一区二区三区日韩视频| 中文字幕日韩一区| 欧美日韩成人一区二区| 日韩中文字幕区一区有砖一区| 91蝌蚪porny九色| 欧美一级免费观看| 欧美高清视频不卡网| 国产亚洲精品超碰| 国产精品高潮呻吟| 不卡一区中文字幕| 久久久99精品免费观看| 自拍视频在线观看一区二区| 国产精品久久久久aaaa樱花| 欧美一区二区三区视频在线| 日本女人一区二区三区| 国产亚洲综合性久久久影院| 99久久精品国产麻豆演员表| 日韩精品免费视频人成| 免费在线成人网| 蜜桃在线一区二区三区| 国产精品美女久久久久aⅴ国产馆| 91国偷自产一区二区三区成为亚洲经典| 欧美一区二区三区色| 欧美最新大片在线看| 国产成人综合自拍| 日韩一级精品视频在线观看| 亚洲精品日韩综合观看成人91| 国产精品自在在线| 99久久久无码国产精品| 激情综合色丁香一区二区| 国内精品在线播放| 天堂成人免费av电影一区| 亚洲成人av免费| 成人av在线观| 中文子幕无线码一区tr| 国内精品国产成人国产三级粉色| 欧美喷水一区二区| 欧美国产精品一区二区三区| 91色.com| 欧美私人免费视频| 国产精品久久久久久久久免费桃花| 日本不卡123| 国产成人av电影在线播放| 精品一区精品二区高清| 亚洲美腿欧美偷拍| 不卡视频在线看| 亚洲欧洲色图综合| 日韩理论片在线| 99精品偷自拍| 91啪九色porn原创视频在线观看| 国产精品进线69影院| 国产精品久久影院| 日本一区二区在线不卡| 国产亚洲va综合人人澡精品| 国产在线乱码一区二区三区| 国产精品一区专区| 中文久久乱码一区二区| 国产午夜精品一区二区三区四区| 国产mv日韩mv欧美| 成人av手机在线观看| 不卡的av电影在线观看| 综合久久国产九一剧情麻豆| 亚洲免费三区一区二区| 欧美视频一区二| 三级在线观看一区二区| 另类综合日韩欧美亚洲| 日韩av中文字幕一区二区三区| 欧美一级夜夜爽| 国产在线一区观看| 国产成人精品综合在线观看| 国产精品久久久久久久久快鸭| 最新国产の精品合集bt伙计| 欧美伊人久久久久久久久影院| 成人精品亚洲人成在线| 欧美一区午夜视频在线观看 | 不卡一卡二卡三乱码免费网站| 91免费在线视频观看| 国产成人午夜99999| 欧美电影免费观看高清完整版在线 | **欧美大码日韩| 狂野欧美性猛交blacked| 国产99精品国产| 国产精品国产自产拍高清av王其| 亚洲欧洲成人av每日更新|