锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲精品色午夜无码专区日韩,亚洲精品福利网泷泽萝拉,亚洲精品偷拍无码不卡avhttp://m.tkk7.com/lendo/category/20807.htmlzh-cnThu, 05 Apr 2007 03:27:31 GMTThu, 05 Apr 2007 03:27:31 GMT60Spring FrameWork錛峛eans鍖咃紞灞炴х紪杈戝櫒(PropertyEditor)http://m.tkk7.com/lendo/articles/105589.htmllendolendoWed, 04 Apr 2007 04:55:00 GMThttp://m.tkk7.com/lendo/articles/105589.htmlhttp://m.tkk7.com/lendo/comments/105589.htmlhttp://m.tkk7.com/lendo/articles/105589.html#Feedback0http://m.tkk7.com/lendo/comments/commentRss/105589.htmlhttp://m.tkk7.com/lendo/services/trackbacks/105589.html         鏈潵鎯蟲妸beans鍖呮斁鍒頒竴綃囨枃绔犱腑鏉ヨ褰曞緱錛屼笉榪囬殢鐫瀛︿範(fàn)寰楁繁鍏ワ紝鍙戠幇鍘熸潵灝辨槸榪欎竴涓寘錛屼篃鏈夊緢澶氬緱鏈哄埗闇瑕佽緇嗗緱鎻忚堪錛屾墍浠ユ垜榪樻槸鎶婂師鏉ョ殑鏂囨。鎷嗗垎鎴愬嚑涓儴鍒嗭紝榪欐牱鎴戜互鍚巖eview鑷繁瀛︿範(fàn)鐨勬椂鍊欎篃姣旇緝娓呮銆?br>     棣栧厛搴旇璇存槑涓涓嬩粈涔堟槸灞炴х紪杈戝櫒錛屽湪Spring鐨勫簲鐢ㄤ腑緇忓父瑕侀亣鍒拌繖縐嶆儏鍐碉紝JavaBean鐨勫兼槸鍦ㄨ繍琛岀殑鏃跺欏姩鎬佸湴浠庨厤緗枃浠朵腑娉ㄥ叆鐨勶紝鑰岄厤緗枃浠朵腑灞炴х殑鍊奸兘鏄疭tring綾誨瀷鐨勶紝瀵瑰簲鐨凧avaBean涓嵈鏈夊叾浠栧緢澶氱被鍨嬶紝濡侱ate,Integer,Byte絳夛紝鎵浠ュ睘鎬х紪杈戝櫒鐨勪換鍔″氨鏄湪Spring榪涜娉ㄥ叆榪欎釜鍔ㄤ綔鐨勬椂鍊欙紝灝哠tring綾誨瀷鐨勬暟鎹漿鍖栦負(fù)JavaBean瀵瑰簲鐨勭被鍨嬨?br>     姣斿濡備笅榪欐浠g爜錛孶serBean鏄竴涓爣鍑嗙殑JavaBean錛屾湁Integer id鍜孲tring userName涓や釜灞炴с?br>    
     public class TestBeanWrapper extends TestCase {
         public void testPropertyEditor() throws Exception{
             Object obj = Class.forName("com.ws.po.UserBean").newInstance();
             BeanWrapper bw = new BeanWrapperImpl(obj);錛圓錛?/榪欓噷灝辮鍋氭敞鍐屽睘鎬х紪杈戝櫒鐨勫伐浣?br>             bw.setPropertyValue("id", "1");錛圔錛?br>             System.out.println(bw.getPropertyValue("id").getClass());錛圕錛?br>         }
    
}

     鍦ㄤ唬鐮丄榪欓噷錛屽氨闇瑕佹敞鍐屽睘鎬х紪杈戝櫒錛屼篃鏄疭pring Ioc鏈哄埗鐨勫叧閿儴鍒嗐?br>     鍦ㄤ唬鐮丅榪欓噷錛屾垜騫舵病鏈変紶鍏ew Integer(1)錛岃屾槸鐩存帴浼犲叆浜嗕竴涓瓧絎︿覆“1”銆?br>     鍦ㄤ唬鐮丆榪欓噷錛屽氨寰楀埌浜嗘垜鎯寵鐨勭被鍨嬶紝杈撳嚭緇撴灉涓猴細(xì)class java.lang.Integer銆?br>     濡傛灉浣犺瘯鍥懼湪B浠g爜榪欓噷錛屽皢“1”鏇存崲涓?#8220;SSSS”瀛楃涓詫紝閭d箞浼?xì)寰楀堫C竴涓猅ypeMismatchException錛屾彁紺烘棤娉曡漿鎹€?/font>

     閭d箞鍦ㄤ唬鐮丄榪欓噷鍒板簳鍙戠敓浜嗕簺浠涔堝憿(鍙拡瀵瑰睘鎬х紪杈戝櫒鏉ヨ)錛熶笅闈竴灞傚眰鍦板線閲岄潰璧般?br>    榪欐浠g爜閲岄潰娌℃湁浠諱綍鐨勬湁鍏沖睘鎬х紪杈戝櫒鐨勪唬鐮侊紝閭d箞灝卞彧鏈夊線BeanWrapperImpl閲岄潰鏌ユ壘銆?br>
     public BeanWrapperImpl(Object object) {
         registerDefaultEditors();//榪欓噷灝卞紑濮嬫敞鍐岄粯璁ょ殑灞炴х紪杈戝櫒浜?br>         setWrappedInstance(object);
     }
 

     
BeanWrapperImpl綾葷戶鎵胯嚜AbstractPropertyAccessor鎶借薄綾伙紝AbstractPropertyAccessor綾誨張緇ф壙鑷狿ropertyEditorRegistrySupport綾伙紝鍦≒ropertyEditorRegistrySupport涓氨瀹炵幇浜唕egisterDefaultEditors()榪欎釜鏂規(guī)硶錛屼唬鐮佸涓嬶細(xì)

     protected void registerDefaultEditors() {
         this.defaultEditors = new HashMap(32);

         // Simple editors, without parameterization capabilities.
         // The JDK does not contain a default editor for any of these target types.
         this.defaultEditors.put(Class.class, new ClassEditor());
         this.defaultEditors.put(Class[].class, new ClassArrayEditor());
         this.defaultEditors.put(File.class, new FileEditor());
         this.defaultEditors.put(InputStream.class, new InputStreamEditor());
         this.defaultEditors.put(Locale.class, new LocaleEditor());
         this.defaultEditors.put(Properties.class, new PropertiesEditor());
         this.defaultEditors.put(Resource[].class, new ResourceArrayPropertyEditor());
         this.defaultEditors.put(URL.class, new URLEditor());

         // Register JDK-1.4-specific editors.
         if (JdkVersion.isAtLeastJava14()) {
             this.defaultEditors.put(URI.class, new URIEditor());
             this.defaultEditors.put(Pattern.class, new PatternEditor());
         }

         // Default instances of collection editors.
         // Can be overridden by registering custom instances of those as custom editors.
         this.defaultEditors.put(Collection.class, new CustomCollectionEditor(Collection.class));
         this.defaultEditors.put(Set.class, new CustomCollectionEditor(Set.class));
         this.defaultEditors.put(SortedSet.class, new CustomCollectionEditor(SortedSet.class));
         this.defaultEditors.put(List.class, new CustomCollectionEditor(List.class));
         this.defaultEditors.put(SortedMap.class, new CustomMapEditor(SortedMap.class));

         // Default editors for primitive arrays.
         this.defaultEditors.put(byte[].class, new ByteArrayPropertyEditor());
         this.defaultEditors.put(char[].class, new CharArrayPropertyEditor());

         // The JDK does not contain a default editor for char!
         this.defaultEditors.put(char.class, new CharacterEditor(false));
         this.defaultEditors.put(Character.class, new CharacterEditor(true));

         // Spring's CustomBooleanEditor accepts more flag values than the JDK's default editor.
         this.defaultEditors.put(boolean.class, new CustomBooleanEditor(false));
         this.defaultEditors.put(Boolean.class, new CustomBooleanEditor(true));

         // The JDK does not contain default editors for number wrapper types!
         // Override JDK primitive number editors with our own CustomNumberEditor.
         this.defaultEditors.put(byte.class, new CustomNumberEditor(Byte.class, false));
         this.defaultEditors.put(Byte.class, new CustomNumberEditor(Byte.class, true));
         this.defaultEditors.put(short.class, new CustomNumberEditor(Short.class, false));
         this.defaultEditors.put(Short.class, new CustomNumberEditor(Short.class, true));
         this.defaultEditors.put(int.class, new CustomNumberEditor(Integer.class, false));
         this.defaultEditors.put(Integer.class, new CustomNumberEditor(Integer.class, true));
         this.defaultEditors.put(long.class, new CustomNumberEditor(Long.class, false));
         this.defaultEditors.put(Long.class, new CustomNumberEditor(Long.class, true));
         this.defaultEditors.put(float.class, new CustomNumberEditor(Float.class, false));
         this.defaultEditors.put(Float.class, new CustomNumberEditor(Float.class, true));
         this.defaultEditors.put(double.class, new CustomNumberEditor(Double.class, false));
         this.defaultEditors.put(Double.class, new CustomNumberEditor(Double.class, true));
         this.defaultEditors.put(BigDecimal.class, new CustomNumberEditor(BigDecimal.class, true));
         this.defaultEditors.put(BigInteger.class, new CustomNumberEditor(BigInteger.class, true));
    }



lendo 2007-04-04 12:55 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 精品国产免费观看| 最近中文字幕无免费| 亚洲AV香蕉一区区二区三区| 99re免费99re在线视频手机版| 亚洲精品无码乱码成人| 中文字幕的电影免费网站| 国产美女做a免费视频软件| 亚洲日本成本人观看| 波多野结衣在线免费观看| 亚洲视频一区在线播放| 永久黄色免费网站| 91天堂素人精品系列全集亚洲| 美女无遮挡拍拍拍免费视频| 国产一级一片免费播放i| 色久悠悠婷婷综合在线亚洲| 久久综合九九亚洲一区| 精品视频在线免费观看| 人妻免费久久久久久久了| 日韩吃奶摸下AA片免费观看| 亚洲视频在线观看地址| 国产成人精品免费视频网页大全| 亚洲国产精品婷婷久久| 最近中文字幕2019高清免费| 国产啪亚洲国产精品无码| 青草青草视频2免费观看| 免费看成人AA片无码视频羞羞网| 亚洲视频中文字幕| 久久免费线看线看| 亚洲日产2021三区在线| 一个人免费观看www视频在线 | 成人免费乱码大片A毛片| 亚洲色精品88色婷婷七月丁香| 亚洲精品国产日韩无码AV永久免费网| AV在线亚洲男人的天堂| 免费人成激情视频在线观看冫| 亚洲色婷婷一区二区三区| 无码国产精品一区二区免费vr | 亚洲AV无码国产精品永久一区| 国产aa免费视频| 人妻18毛片a级毛片免费看| 亚洲欧洲日产国码无码久久99|