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

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

?? propertymatches.java

?? spring framework 2.5.4源代碼
?? JAVA
字號:
/*
 * Copyright 2002-2006 the original author or authors.
 *
 * Licensed 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.springframework.beans;

import java.beans.PropertyDescriptor;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;

/**
 * Helper class for calculating bean property matches, according to.
 * Used by BeanWrapperImpl to suggest alternatives for an invalid property name.
 *
 * @author Alef Arendsen
 * @author Arjen Poutsma
 * @author Juergen Hoeller
 * @since 2.0
 * @see #forProperty(String, Class)
 */
final class PropertyMatches {

	//---------------------------------------------------------------------
	// Static section
	//---------------------------------------------------------------------

	/** Default maximum property distance: 2 */
	public static final int DEFAULT_MAX_DISTANCE = 2;


	/**
	 * Create PropertyMatches for the given bean property.
	 * @param propertyName the name of the property to find possible matches for
	 * @param beanClass the bean class to search for matches
	 */
	public static PropertyMatches forProperty(String propertyName, Class beanClass) {
		return forProperty(propertyName, beanClass, DEFAULT_MAX_DISTANCE);
	}

	/**
	 * Create PropertyMatches for the given bean property.
	 * @param propertyName the name of the property to find possible matches for
	 * @param beanClass the bean class to search for matches
	 * @param maxDistance the maximum property distance allowed for matches
	 */
	public static PropertyMatches forProperty(String propertyName, Class beanClass, int maxDistance) {
		return new PropertyMatches(propertyName, beanClass, maxDistance);
	}


	//---------------------------------------------------------------------
	// Instance section
	//---------------------------------------------------------------------

	private final String propertyName;

	private String[] possibleMatches;


	/**
	 * Create a new PropertyMatches instance for the given property.
	 */
	private PropertyMatches(String propertyName, Class beanClass, int maxDistance) {
		this.propertyName = propertyName;
		this.possibleMatches = calculateMatches(BeanUtils.getPropertyDescriptors(beanClass), maxDistance);
	}


	/**
	 * Return the calculated possible matches.
	 */
	public String[] getPossibleMatches() {
		return possibleMatches;
	}

	/**
	 * Build an error message for the given invalid property name,
	 * indicating the possible property matches.
	 */
	public String buildErrorMessage() {
		StringBuffer buf = new StringBuffer();
		buf.append("Bean property '");
		buf.append(this.propertyName);
		buf.append("' is not writable or has an invalid setter method. ");

		if (ObjectUtils.isEmpty(this.possibleMatches)) {
			buf.append("Does the parameter type of the setter match the return type of the getter?");
		}
		else {
			buf.append("Did you mean ");
			for (int i = 0; i < this.possibleMatches.length; i++) {
				buf.append('\'');
				buf.append(this.possibleMatches[i]);
				if (i < this.possibleMatches.length - 2) {
					buf.append("', ");
				}
				else if (i == this.possibleMatches.length - 2){
					buf.append("', or ");
				}
	 		}
			buf.append("'?");
		}
		return buf.toString();
	}


	/**
	 * Generate possible property alternatives for the given property and
	 * class. Internally uses the <code>getStringDistance</code> method, which
	 * in turn uses the Levenshtein algorithm to determine the distance between
	 * two Strings.
	 * @param propertyDescriptors the JavaBeans property descriptors to search
	 * @param maxDistance the maximum distance to accept
	 */
	private String[] calculateMatches(PropertyDescriptor[] propertyDescriptors, int maxDistance) {
		List candidates = new ArrayList();
		for (int i = 0; i < propertyDescriptors.length; i++) {
			if (propertyDescriptors[i].getWriteMethod() != null) {
				String possibleAlternative = propertyDescriptors[i].getName();
				if (calculateStringDistance(this.propertyName, possibleAlternative) <= maxDistance) {
					candidates.add(possibleAlternative);
				}
			}
		}
		Collections.sort(candidates);
		return StringUtils.toStringArray(candidates);
	}

	/**
	 * Calculate the distance between the given two Strings
	 * according to the Levenshtein algorithm.
	 * @param s1 the first String
	 * @param s2 the second String
	 * @return the distance value
	 */
	private int calculateStringDistance(String s1, String s2) {
		if (s1.length() == 0) {
			return s2.length();
		}
		if (s2.length() == 0) {
			return s1.length();
		}
		int d[][] = new int[s1.length() + 1][s2.length() + 1];

		for (int i = 0; i <= s1.length(); i++) {
			d[i][0] = i;
		}
		for (int j = 0; j <= s2.length(); j++) {
			d[0][j] = j;
		}

		for (int i = 1; i <= s1.length(); i++) {
			char s_i = s1.charAt(i - 1);
			for (int j = 1; j <= s2.length(); j++) {
				int cost;
				char t_j = s2.charAt(j - 1);
				if (s_i == t_j) {
					cost = 0;
				} else {
					cost = 1;
				}
				d[i][j] = Math.min(Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1),
						d[i - 1][j - 1] + cost);
			}
		}

		return d[s1.length()][s2.length()];
	}

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
老司机午夜精品99久久| 91官网在线观看| 亚洲免费在线视频| 欧美三级资源在线| 免费人成黄页网站在线一区二区| 日韩一级在线观看| 东方欧美亚洲色图在线| 自拍偷自拍亚洲精品播放| 色偷偷88欧美精品久久久| 日韩成人免费在线| 国产日韩精品一区二区三区在线| 欧美写真视频网站| 丁香另类激情小说| 日本不卡视频在线| 亚洲国产精品欧美一二99| 日韩美女久久久| 国产亚洲欧美日韩俺去了| 欧美日韩亚州综合| 成人av电影在线网| 国产精品白丝av| 亚洲成人在线网站| 亚洲综合激情另类小说区| 亚洲欧美日韩国产另类专区| 国产性做久久久久久| 久久综合九色综合久久久精品综合| 欧美日韩一级片网站| 欧美视频在线播放| 欧美日韩国产综合一区二区| 一本色道久久综合亚洲精品按摩| a级精品国产片在线观看| 欧美一级日韩一级| 精品视频在线视频| 欧美三级三级三级| 欧美一级午夜免费电影| 中文无字幕一区二区三区 | 久久久蜜臀国产一区二区| 国产欧美日产一区| 亚洲大片一区二区三区| 蜜桃久久av一区| 春色校园综合激情亚洲| 欧美美女一区二区三区| 国产欧美日韩综合精品一区二区| 亚洲人成在线观看一区二区| 国产麻豆视频精品| 欧美二区三区91| 亚洲视频一二三| 精品一区二区在线播放| 色又黄又爽网站www久久| 91精品国产日韩91久久久久久| 久久精品视频网| 日日噜噜夜夜狠狠视频欧美人| 国产福利一区二区三区| 欧美精品vⅰdeose4hd| 日本一区二区成人| 九色|91porny| 欧美揉bbbbb揉bbbbb| 最新国产成人在线观看| 国产成人精品网址| 国产激情精品久久久第一区二区| 天堂一区二区在线| 欧美高清www午色夜在线视频| 亚洲一级二级在线| 国产精品1区2区| 7777精品伊人久久久大香线蕉经典版下载 | 亚洲精品在线三区| 一区二区三区在线免费视频| 韩日欧美一区二区三区| 在线播放中文一区| 亚洲综合在线免费观看| 不卡影院免费观看| 亚洲最快最全在线视频| 91精品国产综合久久久久久| 一区二区在线观看视频| 色婷婷综合视频在线观看| 一个色妞综合视频在线观看| 在线观看日产精品| 老汉av免费一区二区三区| 91精品国产麻豆国产自产在线| 免费国产亚洲视频| 国产精品免费av| 成人白浆超碰人人人人| 欧美二区乱c少妇| 欧美性大战久久久| 色噜噜狠狠色综合中国| 国产成人精品综合在线观看| 亚洲黄色av一区| 国产无一区二区| 欧美一级欧美一级在线播放| 成人黄色在线看| 日本va欧美va欧美va精品| 国产精品乱人伦| 欧美成人性战久久| 欧美日韩高清在线播放| gogo大胆日本视频一区| 国模套图日韩精品一区二区| 精品一区二区免费看| 亚洲日穴在线视频| 欧美国产日韩精品免费观看| 欧美一区二区三区四区视频| 欧美日韩在线三级| 99精品国产热久久91蜜凸| 国内成人精品2018免费看| 亚洲福利一二三区| 亚洲欧美日韩在线| 国产精品电影一区二区| 国产欧美久久久精品影院| 精品日产卡一卡二卡麻豆| 欧美日韩在线播| 日韩三级视频在线观看| 91精品婷婷国产综合久久竹菊| 51精品秘密在线观看| 久久久美女毛片| 亚洲一区二区视频| 国产一区二区三区在线观看精品 | 成人午夜视频在线| 免费成人深夜小野草| 韩国女主播成人在线| 国模套图日韩精品一区二区| 粉嫩av一区二区三区| 一本久久精品一区二区| 欧洲国内综合视频| 欧美日本不卡视频| 欧美精品一区二区三区在线| 久久综合色天天久久综合图片| 久久久精品tv| 亚洲国产日韩一级| 精品一区二区国语对白| 色婷婷久久一区二区三区麻豆| aaa欧美日韩| ww久久中文字幕| 亚洲免费看黄网站| 精品一区在线看| 欧美在线视频全部完| 26uuu国产日韩综合| 亚洲线精品一区二区三区八戒| 精品无人区卡一卡二卡三乱码免费卡| 国产成人福利片| 日韩视频永久免费| 亚洲综合自拍偷拍| caoporen国产精品视频| 欧美精品一区二区三区蜜臀| 秋霞国产午夜精品免费视频| 91成人网在线| 亚洲国产精品久久人人爱蜜臀| 成人短视频下载| 欧美韩国日本不卡| 国产精品99久久久久久久vr| 欧美精品一二三四| 一级日本不卡的影视| 色伊人久久综合中文字幕| 亚洲免费在线视频一区 二区| 91亚洲精品乱码久久久久久蜜桃| 国产日韩欧美亚洲| 不卡av免费在线观看| 婷婷六月综合亚洲| 日本韩国一区二区三区视频| 亚洲欧美另类小说| 欧美性猛交xxxxxx富婆| 亚洲一区二区3| 欧美日韩一区二区电影| 日本aⅴ精品一区二区三区| 日韩欧美亚洲国产另类| 国产一区二区调教| 中文字幕日本乱码精品影院| av影院午夜一区| 午夜精品一区在线观看| 日韩一二三区不卡| 蜜臀av一区二区在线免费观看| 26uuu亚洲综合色| 一本一道综合狠狠老| 国产麻豆成人精品| 亚洲女同一区二区| 精品国产免费人成电影在线观看四季 | 国产成人综合网| 亚洲高清视频中文字幕| 国产精品久久毛片| 4438成人网| 94-欧美-setu| 国产精品一区二区不卡| 亚洲最新视频在线观看| 国产精品入口麻豆原神| 精品国产乱码久久久久久图片 | 91美女片黄在线观看| 国模冰冰炮一区二区| 午夜精品免费在线| 综合色中文字幕| 国产欧美一区二区精品久导航 | 91精品国产福利在线观看 | 久久er精品视频| 日本欧美一区二区在线观看| 亚洲欧美激情视频在线观看一区二区三区| 欧美一区二区三区系列电影| 欧美日韩夫妻久久| 欧美日韩国产三级| 在线视频一区二区三区| 91久久香蕉国产日韩欧美9色| 99久久精品国产一区| caoporen国产精品视频| 99re这里都是精品| 欧美在线观看一区|