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

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

?? beanpropertyvalueequalspredicate.java

?? 這是一個(gè)有關(guān)common beanutils 的源碼
?? JAVA
字號(hào):
/*
 * 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 org.apache.commons.collections.Predicate;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.lang.reflect.InvocationTargetException;


/**
 * <p><code>Predicate</code> that evaluates a property value against a specified value.</p>
 * <p>
 * An implementation of <code>org.apache.commons.collections.Predicate</code> that evaluates a
 * property value on the object provided against a specified value and returns <code>true</code>
 * if equal; <code>false</code> otherwise.
 * The <code>BeanPropertyValueEqualsPredicate</code> constructor takes two parameters which
 * determine what property will be evaluated on the target object and what its expected value should
 * be.
 * <dl>
 *    <dt>
 *       <strong><code>
 *           <pre>public BeanPropertyValueEqualsPredicate( String propertyName, Object propertyValue )</pre>
 *       </code></strong>
 *    </dt>
 *    <dd>
 *       Will create a <code>Predicate</code> that will evaluate the target object and return
 *       <code>true</code> if the property specified by <code>propertyName</code> has a value which
 *       is equal to the the value specified by <code>propertyValue</code>. Or return
 *       <code>false</code> otherwise.
 *    </dd>
 * </dl>
 * </p>
 * <p>
 * <strong>Note:</strong> Property names can be a simple, nested, indexed, or mapped property as defined by
 * <code>org.apache.commons.beanutils.PropertyUtils</code>.  If any object in the property path
 * specified by <code>propertyName</code> is <code>null</code> then the outcome is based on the
 * value of the <code>ignoreNull</code> attribute.
 * </p>
 * <p>
 * A typical usage might look like:
 * <code><pre>
 * // create the closure
 * BeanPropertyValueEqualsPredicate predicate =
 *    new BeanPropertyValueEqualsPredicate( "activeEmployee", Boolean.FALSE );
 *
 * // filter the Collection
 * CollectionUtils.filter( peopleCollection, predicate );
 * </pre></code>
 * </p>
 * <p>
 * This would take a <code>Collection</code> of person objects and filter out any people whose
 * <code>activeEmployee</code> property is <code>false</code>. Assuming...
 * <ul>
 *    <li>
 *       The top level object in the <code>peeopleCollection</code> is an object which represents a
 *       person.
 *    </li>
 *    <li>
 *       The person object has a <code>getActiveEmployee()</code> method which returns
 *       the boolean value for the object's <code>activeEmployee</code> property.
 *    </li>
 * </ul>
 * </p>
 * <p>
 * Another typical usage might look like:
 * <code><pre>
 * // create the closure
 * BeanPropertyValueEqualsPredicate predicate =
 *    new BeanPropertyValueEqualsPredicate( "personId", "456-12-1234" );
 *
 * // search the Collection
 * CollectionUtils.find( peopleCollection, predicate );
 * </pre><code>
 * </p>
 * <p>
 * This would search a <code>Collection</code> of person objects and return the first object whose
 * <code>personId</code> property value equals <code>456-12-1234</code>. Assuming...
 * <ul>
 *    <li>
 *       The top level object in the <code>peeopleCollection</code> is an object which represents a
 *       person.
 *    </li>
 *    <li>
 *       The person object has a <code>getPersonId()</code> method which returns
 *       the value for the object's <code>personId</code> property.
 *    </li>
 * </ul>
 * </p>
 *
 * @author Norm Deane
 * @see org.apache.commons.beanutils.PropertyUtils
 * @see org.apache.commons.collections.Predicate
 */
public class BeanPropertyValueEqualsPredicate implements Predicate {
   
    /** For logging. */
    private final Log log = LogFactory.getLog(this.getClass());

    /**
     * The name of the property which will be evaluated when this <code>Predicate</code> is executed.
     */
    private String propertyName;

    /**
     * The value that the property specified by <code>propertyName</code>
     * will be compared to when this <code>Predicate</code> executes.
     */
    private Object propertyValue;

    /**
     * <p>Should <code>null</code> objects in the property path be ignored?</p>
     * <p>
     * Determines whether <code>null</code> objects in the property path will genenerate an
     * <code>IllegalArgumentException</code> or not. If set to <code>true</code> then if any objects
     * in the property path evaluate to <code>null</code> then the
     * <code>IllegalArgumentException</code> throw by <code>PropertyUtils</code> will be logged but
     * not rethrown and <code>false</code> will be returned.  If set to <code>false</code> then if
     * any objects in the property path evaluate to <code>null</code> then the
     * <code>IllegalArgumentException</code> throw by <code>PropertyUtils</code> will be logged and
     * rethrown.
     * </p>
     */
    private boolean ignoreNull;

    /**
     * Constructor which takes the name of the property, its expected value to be used in evaluation,
     * and assumes <code>ignoreNull</code> to be <code>false</code>.
     *
     * @param propertyName The name of the property that will be evaluated against the expected value.
     * @param propertyValue The value to use in object evaluation.
     * @throws IllegalArgumentException If the property name provided is null or empty.
     */
    public BeanPropertyValueEqualsPredicate(String propertyName, Object propertyValue) {
        this(propertyName, propertyValue, false);
    }

    /**
     * Constructor which takes the name of the property, its expected value
     * to be used in evaluation, and a boolean which determines whether <code>null</code> objects in
     * the property path will genenerate an <code>IllegalArgumentException</code> or not.
     *
     * @param propertyName The name of the property that will be evaluated against the expected value.
     * @param propertyValue The value to use in object evaluation.
     * @param ignoreNull Determines whether <code>null</code> objects in the property path will
     * genenerate an <code>IllegalArgumentException</code> or not.
     * @throws IllegalArgumentException If the property name provided is null or empty.
     */
    public BeanPropertyValueEqualsPredicate(String propertyName, Object propertyValue, boolean ignoreNull) {
        super();

        if ((propertyName != null) && (propertyName.length() > 0)) {
            this.propertyName = propertyName;
            this.propertyValue = propertyValue;
            this.ignoreNull = ignoreNull;
        } else {
            throw new IllegalArgumentException("propertyName cannot be null or empty");
        }
    }

    /**
     * Evaulates the object provided against the criteria specified when this
     * <code>BeanPropertyValueEqualsPredicate</code> was constructed.  Equality is based on
     * either reference or logical equality as defined by the property object's equals method. If
     * any object in the property path leading up to the target property is <code>null</code> then
     * the outcome will be based on the value of the <code>ignoreNull</code> attribute. By default,
     * <code>ignoreNull</code> is <code>false</code> and would result in an
     * <code>IllegalArgumentException</code> if an object in the property path leading up to the
     * target property is <code>null</code>.
     *
     * @param object The object to be evaluated.
     * @return True if the object provided meets all the criteria for this <code>Predicate</code>;
     * false otherwise.
     * @throws IllegalArgumentException If an IllegalAccessException, InvocationTargetException, or
     * NoSuchMethodException is thrown when trying to access the property specified on the object
     * provided. Or if an object in the property path provided is <code>null</code> and
     * <code>ignoreNull</code> is set to <code>false</code>.
     */
    public boolean evaluate(Object object) {
       
        boolean evaluation = false;

        try {
            evaluation = evaluateValue(propertyValue,
                    PropertyUtils.getProperty(object, propertyName));
        } catch (IllegalArgumentException e) {
            final String errorMsg = "Problem during evaluation. Null value encountered in property path...";

            if (ignoreNull) {
                log.warn("WARNING: " + errorMsg + e);
            } else {
                IllegalArgumentException iae = new IllegalArgumentException(errorMsg);
                if (!BeanUtils.initCause(iae, e)) {
                    log.error(errorMsg, e);
                }
                throw iae;
            }
        } catch (IllegalAccessException e) {
            final String errorMsg = "Unable to access the property provided.";
            IllegalArgumentException iae = new IllegalArgumentException(errorMsg);
            if (!BeanUtils.initCause(iae, e)) {
                log.error(errorMsg, e);
            }
            throw iae;
        } catch (InvocationTargetException e) {
            final String errorMsg = "Exception occurred in property's getter";
            IllegalArgumentException iae = new IllegalArgumentException(errorMsg);
            if (!BeanUtils.initCause(iae, e)) {
                log.error(errorMsg, e);
            }
            throw iae;
        } catch (NoSuchMethodException e) {
            final String errorMsg = "Property not found.";
            IllegalArgumentException iae = new IllegalArgumentException(errorMsg);
            if (!BeanUtils.initCause(iae, e)) {
                log.error(errorMsg, e);
            }
            throw iae;
        }

        return evaluation;
    }

    /**
     * Utility method which evaluates whether the actual property value equals the expected property
     * value.
     *
     * @param expected The expected value.
     * @param actual The actual value.
     * @return True if they are equal; false otherwise.
     */
    private boolean evaluateValue(Object expected, Object actual) {
        return (expected == actual) || ((expected != null) && expected.equals(actual));
    }

    /**
     * Returns the name of the property which will be evaluated when this <code>Predicate</code> is
     * executed.
     *
     * @return The name of the property which will be evaluated when this <code>Predicate</code> is
     * executed.
     */
    public String getPropertyName() {
        return propertyName;
    }

    /**
     * Returns the value that the property specified by <code>propertyName</code> will be compared to
     * when this <code>Predicate</code> executes.
     *
     * @return The value that the property specified by <code>propertyName</code> will be compared to
     * when this <code>Predicate</code> executes.
     */
    public Object getPropertyValue() {
        return propertyValue;
    }

    /**
     * Returns the flag which determines whether <code>null</code> objects in the property path will
     * genenerate an <code>IllegalArgumentException</code> or not. If set to <code>true</code> then
     * if any objects in the property path evaluate to <code>null</code> then the
     * <code>IllegalArgumentException</code> throw by <code>PropertyUtils</code> will be logged but
     * not rethrown and <code>false</code> will be returned.  If set to <code>false</code> then if
     * any objects in the property path evaluate to <code>null</code> then the
     * <code>IllegalArgumentException</code> throw by <code>PropertyUtils</code> will be logged and
     * rethrown.
     *
     * @return The flag which determines whether <code>null</code> objects in the property path will
     * genenerate an <code>IllegalArgumentException</code> or not.
     */
    public boolean isIgnoreNull() {
        return ignoreNull;
    }
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
麻豆精品一区二区综合av| 视频一区视频二区中文字幕| 欧美日韩电影在线| 在线一区二区三区四区| 欧美色涩在线第一页| 欧美亚洲尤物久久| 在线成人免费视频| 日韩午夜中文字幕| 国产日产欧美一区二区视频| 国产嫩草影院久久久久| **欧美大码日韩| 亚洲一区二区三区不卡国产欧美| 一区二区三区高清在线| 偷拍与自拍一区| 久久99热这里只有精品| 成人深夜在线观看| 在线中文字幕一区二区| 欧美一区二区在线视频| 久久久精品天堂| 亚洲免费观看视频| 日韩国产精品大片| 国产一区二区久久| 国产999精品久久久久久| 色综合久久久久久久| 欧美一区二区三区视频免费| 久久久久国产精品麻豆| 一区二区三区日韩精品| 美女爽到高潮91| av一区二区三区在线| 欧美久久一区二区| 欧美激情一区二区| 日韩国产精品久久久久久亚洲| 国产一区二区伦理片| 在线观看免费亚洲| 亚洲国产精品精华液2区45| 亚洲午夜影视影院在线观看| 极品美女销魂一区二区三区免费 | 日韩丝袜情趣美女图片| 国产清纯白嫩初高生在线观看91 | 成人福利电影精品一区二区在线观看| 91亚洲精品一区二区乱码| 日韩欧美精品在线视频| 亚洲黄色免费网站| 粉嫩蜜臀av国产精品网站| 欧美人狂配大交3d怪物一区| 国产精品动漫网站| 国产在线精品免费av| 欧美日韩中文国产| 亚洲欧美日韩国产手机在线| 国产一区二区伦理| 欧美肥大bbwbbw高潮| 亚洲精品中文在线| 国产酒店精品激情| 欧美变态tickle挠乳网站| 国产精品国产三级国产普通话三级| 天天影视涩香欲综合网| 在线一区二区三区四区五区| 国产欧美日韩精品一区| 国产麻豆视频精品| 日韩精品中文字幕在线不卡尤物| 亚洲成人自拍偷拍| 欧美优质美女网站| 一区二区欧美精品| 色一区在线观看| 一区二区三区欧美| 欧洲一区二区三区免费视频| 亚洲综合另类小说| www.欧美日韩| 国产精品乱码人人做人人爱| 国产成人在线网站| 欧美国产一区视频在线观看| 国产一区久久久| 久久精品欧美日韩| 不卡高清视频专区| 亚洲婷婷综合色高清在线| 波多野结衣在线aⅴ中文字幕不卡| 亚洲国产精品黑人久久久| 国产成a人亚洲精| 中文字幕不卡三区| 97精品超碰一区二区三区| 最新热久久免费视频| 91久久国产综合久久| 亚洲高清视频在线| 日韩三区在线观看| 国产乱理伦片在线观看夜一区| 2023国产精品自拍| 成人精品在线视频观看| 亚洲精品五月天| 欧美精品日韩精品| 精品午夜一区二区三区在线观看| 精品国产乱码91久久久久久网站| 国产一区二区精品久久| 国产精品网站在线| 欧美午夜不卡视频| 久久99精品久久久久久久久久久久| 久久众筹精品私拍模特| 91小宝寻花一区二区三区| 午夜成人在线视频| 日本一区二区免费在线| 91久久国产综合久久| 麻豆精品在线播放| 亚洲视频小说图片| 日韩一区二区中文字幕| 波多野结衣亚洲| 日韩av电影一区| 最新热久久免费视频| 日韩写真欧美这视频| 成人免费看黄yyy456| 日日夜夜精品免费视频| 国产午夜亚洲精品不卡| 欧美午夜不卡视频| 国产ts人妖一区二区| 亚洲国产精品一区二区www在线| 亚洲精品一区二区三区99| 色婷婷av一区二区| 日韩中文字幕区一区有砖一区| 久久久久久亚洲综合| 在线视频一区二区免费| 国产一区二区视频在线| 一区二区三区在线免费播放| 国产欧美日韩在线视频| 51精品国自产在线| 在线观看一区二区精品视频| 国产美女av一区二区三区| 五月天激情综合网| 亚洲色图欧美激情| 久久婷婷国产综合精品青草| 欧美在线综合视频| jizzjizzjizz欧美| 久久国产精品无码网站| 一区二区三区不卡视频在线观看| 国产色综合一区| 精品乱人伦小说| 色噜噜狠狠一区二区三区果冻| 国产资源在线一区| 麻豆成人av在线| 午夜视频在线观看一区| 亚洲精品日韩综合观看成人91| 国产欧美一区二区精品仙草咪 | 成人污污视频在线观看| 欧美aaaaa成人免费观看视频| 亚洲精品视频自拍| 久久日韩粉嫩一区二区三区| 欧美大片在线观看| 日韩精品一区二区三区在线播放 | 亚洲一区二区在线视频| 亚洲婷婷综合久久一本伊一区| 国产免费成人在线视频| 国产亚洲一本大道中文在线| 2014亚洲片线观看视频免费| 精品久久久久久久久久久久久久久| 欧美一区二区免费| 精品欧美一区二区久久| 久久久久久久久伊人| 日本一区二区三区国色天香| 国产精品日韩成人| 亚洲欧美一区二区三区国产精品 | 日韩一级精品视频在线观看| 欧美一卡二卡在线| 久久亚洲精华国产精华液| 久久精品视频免费观看| 国产精品久久久久毛片软件| 国产精品嫩草影院av蜜臀| 亚洲欧洲www| 一区二区高清视频在线观看| 亚洲v日本v欧美v久久精品| 日日夜夜精品视频天天综合网| 麻豆精品在线看| 成人激情小说乱人伦| 色婷婷久久久亚洲一区二区三区| 日韩一区二区三区在线视频| 日韩三区在线观看| 中日韩免费视频中文字幕| 一区二区三区中文字幕| 美洲天堂一区二卡三卡四卡视频| 国产综合久久久久影院| 国产成人在线视频网站| 欧美性色黄大片| 精品精品国产高清一毛片一天堂| 久久亚洲影视婷婷| 亚洲综合色成人| 国产精品69毛片高清亚洲| 欧美优质美女网站| 久久精品夜色噜噜亚洲a∨ | 91精品久久久久久久91蜜桃| 久久综合色一综合色88| 亚洲精品免费在线观看| 久久成人免费日本黄色| 99久精品国产| 欧美videofree性高清杂交| 国产精品成人网| 日本一区中文字幕 | 777色狠狠一区二区三区| 欧美激情在线一区二区| 天天色天天操综合| www.亚洲精品| 久久九九99视频| 老司机精品视频在线| 欧美视频在线一区二区三区 | 日本不卡1234视频|