锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲精品色午夜无码专区日韩,亚洲精品福利网泷泽萝拉,亚洲精品偷拍无码不卡avhttp://www.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://www.tkk7.com/lendo/articles/105589.htmllendolendoWed, 04 Apr 2007 04:55:00 GMThttp://www.tkk7.com/lendo/articles/105589.htmlhttp://www.tkk7.com/lendo/comments/105589.htmlhttp://www.tkk7.com/lendo/articles/105589.html#Feedback0http://www.tkk7.com/lendo/comments/commentRss/105589.htmlhttp://www.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 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 亚洲国产第一页www| 亚洲欧美日韩中文字幕在线一区| 亚洲国产成人久久精品影视| 久久久久久国产a免费观看不卡| 久久久久久精品免费看SSS| 亚洲va中文字幕无码| 亚洲嫩草影院在线观看| 久久久WWW免费人成精品| 亚洲高清国产AV拍精品青青草原| 精品亚洲国产成人av| 成人免费一区二区无码视频| 亚洲国产精品久久久久网站| 最近免费视频中文字幕大全| 国产亚洲精品资源在线26u| 青娱乐在线免费观看视频| 18禁无遮挡无码网站免费| 亚洲av无码无线在线观看| 四虎在线免费视频| 亚洲国产精品一区二区三区在线观看 | 亚洲国产精品久久人人爱| 视频一区二区三区免费观看| 精品国产亚洲男女在线线电影 | 亚洲一区二区三区偷拍女厕| av片在线观看永久免费| 又粗又大又长又爽免费视频| 亚洲依依成人亚洲社区| 国产一卡2卡3卡4卡无卡免费视频| 91亚洲自偷手机在线观看| 久久伊人免费视频| 91大神亚洲影视在线| 精品久久久久久久免费人妻| 亚洲欧美一区二区三区日产| 亚洲男人av香蕉爽爽爽爽| 国产特黄一级一片免费| 久久狠狠高潮亚洲精品| 久久九九兔免费精品6| 国产亚洲精品国产福利在线观看| 免费观看亚洲人成网站| 免费人成再在线观看网站 | 女人18毛片水真多免费看| 亚洲午夜精品久久久久久app|