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

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

?? propertysetter.java

?? apache的log4j源碼
?? 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. */// Contributors:  Georg Lundesgaardpackage org.apache.log4j.config;import java.beans.Introspector;import java.beans.PropertyDescriptor;import java.beans.BeanInfo;import java.beans.IntrospectionException;import java.lang.reflect.*;import java.util.*;import org.apache.log4j.*;import org.apache.log4j.helpers.LogLog;import org.apache.log4j.helpers.OptionConverter;import org.apache.log4j.spi.OptionHandler;/**   General purpose Object property setter. Clients repeatedly invokes   {@link #setProperty setProperty(name,value)} in order to invoke setters   on the Object specified in the constructor. This class relies on the   JavaBeans {@link Introspector} to analyze the given Object Class using   reflection.      <p>Usage:   <pre>     PropertySetter ps = new PropertySetter(anObject);     ps.set("name", "Joe");     ps.set("age", "32");     ps.set("isMale", "true");   </pre>   will cause the invocations anObject.setName("Joe"), anObject.setAge(32),   and setMale(true) if such methods exist with those signatures.   Otherwise an {@link IntrospectionException} are thrown.     @author Anders Kristensen   @since 1.1 */public class PropertySetter {  protected Object obj;  protected PropertyDescriptor[] props;    /**    Create a new PropertySetter for the specified Object. This is done    in prepartion for invoking {@link #setProperty} one or more times.        @param obj  the object for which to set properties   */  public  PropertySetter(Object obj) {    this.obj = obj;  }    /**     Uses JavaBeans {@link Introspector} to computer setters of object to be     configured.   */  protected  void introspect() {    try {      BeanInfo bi = Introspector.getBeanInfo(obj.getClass());      props = bi.getPropertyDescriptors();    } catch (IntrospectionException ex) {      LogLog.error("Failed to introspect "+obj+": " + ex.getMessage());      props = new PropertyDescriptor[0];    }  }    /**     Set the properties of an object passed as a parameter in one     go. The <code>properties</code> are parsed relative to a     <code>prefix</code>.     @param obj The object to configure.     @param properties A java.util.Properties containing keys and values.     @param prefix Only keys having the specified prefix will be set.  */  public  static  void setProperties(Object obj, Properties properties, String prefix) {    new PropertySetter(obj).setProperties(properties, prefix);  }    /**     Set the properites for the object that match the     <code>prefix</code> passed as parameter.        */  public  void setProperties(Properties properties, String prefix) {    int len = prefix.length();        for (Enumeration e = properties.propertyNames(); e.hasMoreElements(); ) {      String key = (String) e.nextElement();            // handle only properties that start with the desired frefix.      if (key.startsWith(prefix)) {		// ignore key if it contains dots after the prefix        if (key.indexOf('.', len + 1) > 0) {	  //System.err.println("----------Ignoring---["+key	  //	     +"], prefix=["+prefix+"].");	  continue;	}        	String value = OptionConverter.findAndSubst(key, properties);        key = key.substring(len);        if ("layout".equals(key) && obj instanceof Appender) {          continue;        }                setProperty(key, value);      }    }    activate();  }    /**     Set a property on this PropertySetter's Object. If successful, this     method will invoke a setter method on the underlying Object. The     setter is the one for the specified property name and the value is     determined partly from the setter argument type and partly from the     value specified in the call to this method.          <p>If the setter expects a String no conversion is necessary.     If it expects an int, then an attempt is made to convert 'value'     to an int using new Integer(value). If the setter expects a boolean,     the conversion is by new Boolean(value).          @param name    name of the property     @param value   String value of the property   */  public  void setProperty(String name, String value) {    if (value == null) return;        name = Introspector.decapitalize(name);    PropertyDescriptor prop = getPropertyDescriptor(name);        //LogLog.debug("---------Key: "+name+", type="+prop.getPropertyType());    if (prop == null) {      LogLog.warn("No such property [" + name + "] in "+		  obj.getClass().getName()+"." );    } else {      try {        setProperty(prop, name, value);      } catch (PropertySetterException ex) {        LogLog.warn("Failed to set property [" + name +                    "] to value \"" + value + "\". ", ex.rootCause);      }    }  }    /**       Set the named property given a {@link PropertyDescriptor}.      @param prop A PropertyDescriptor describing the characteristics      of the property to set.      @param name The named of the property to set.      @param value The value of the property.         */  public  void setProperty(PropertyDescriptor prop, String name, String value)    throws PropertySetterException {    Method setter = prop.getWriteMethod();    if (setter == null) {      throw new PropertySetterException("No setter for property ["+name+"].");    }    Class[] paramTypes = setter.getParameterTypes();    if (paramTypes.length != 1) {      throw new PropertySetterException("#params for setter != 1");    }        Object arg;    try {      arg = convertArg(value, paramTypes[0]);    } catch (Throwable t) {      throw new PropertySetterException("Conversion to type ["+paramTypes[0]+					"] failed. Reason: "+t);    }    if (arg == null) {      throw new PropertySetterException(          "Conversion to type ["+paramTypes[0]+"] failed.");    }    LogLog.debug("Setting property [" + name + "] to [" +arg+"].");    try {      setter.invoke(obj, new Object[]  { arg });    } catch (Exception ex) {      throw new PropertySetterException(ex);    }  }    /**     Convert <code>val</code> a String parameter to an object of a     given type.  */  protected  Object convertArg(String val, Class type) {    if(val == null)      return null;    String v = val.trim();    if (String.class.isAssignableFrom(type)) {      return val;    } else if (Integer.TYPE.isAssignableFrom(type)) {      return new Integer(v);    } else if (Long.TYPE.isAssignableFrom(type)) {      return new Long(v);    } else if (Boolean.TYPE.isAssignableFrom(type)) {      if ("true".equalsIgnoreCase(v)) {        return Boolean.TRUE;      } else if ("false".equalsIgnoreCase(v)) {        return Boolean.FALSE;      }    } else if (Priority.class.isAssignableFrom(type)) {      return OptionConverter.toLevel(v, (Level) Level.DEBUG);    }    return null;  }      protected  PropertyDescriptor getPropertyDescriptor(String name) {    if (props == null) introspect();        for (int i = 0; i < props.length; i++) {      if (name.equals(props[i].getName())) {	return props[i];      }    }    return null;  }    public  void activate() {    if (obj instanceof OptionHandler) {      ((OptionHandler) obj).activateOptions();    }  }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
美女脱光内衣内裤视频久久影院| 日韩欧美一级特黄在线播放| 欧美日韩国产另类一区| 欧美男人的天堂一二区| 精品国产凹凸成av人导航| 中文字幕av一区二区三区免费看| 成人免费在线观看入口| 视频一区欧美精品| 久久99热狠狠色一区二区| 不卡一区二区三区四区| 欧美人妖巨大在线| 国产精品美女久久久久久久网站| 亚洲狠狠爱一区二区三区| 美女诱惑一区二区| 成人av资源网站| 欧美一区二区在线免费播放| 国产三级精品视频| 香蕉久久一区二区不卡无毒影院| 国内不卡的二区三区中文字幕| 91在线精品一区二区三区| 日韩色视频在线观看| 国产精品福利一区| 裸体在线国模精品偷拍| 亚洲天堂免费在线观看视频| 国产精品美女久久久久av爽李琼 | 免费在线欧美视频| 9色porny自拍视频一区二区| 日韩欧美一区二区视频| 亚洲婷婷综合色高清在线| 经典一区二区三区| 欧美午夜电影网| 中文字幕电影一区| 九九九精品视频| 欧美精品久久久久久久多人混战| 中文一区二区在线观看| 蜜桃视频一区二区| 欧美性感一类影片在线播放| 国产欧美视频在线观看| 免费观看成人av| 欧美亚洲一区三区| 中文字幕一区二区不卡| 极品少妇xxxx精品少妇| 欧美喷水一区二区| 伊人婷婷欧美激情| 成人aa视频在线观看| 久久亚洲综合色一区二区三区| 亚洲成人av在线电影| 99re热视频精品| 日本一区二区三区dvd视频在线| 日本午夜精品视频在线观看 | 亚洲蜜臀av乱码久久精品蜜桃| 国产一区二区三区四区在线观看| 91精品国产综合久久香蕉麻豆 | 色婷婷av一区二区三区gif | 91在线视频官网| 国产亚洲一区字幕| 久久精品国产一区二区三区免费看| 欧美日韩高清一区二区不卡| 亚洲一区二区三区爽爽爽爽爽 | 亚洲3atv精品一区二区三区| 色狠狠色狠狠综合| 亚洲视频综合在线| 91片黄在线观看| 最新国产の精品合集bt伙计| 成人妖精视频yjsp地址| 欧美激情一区二区三区全黄| 国产成都精品91一区二区三| 欧美日韩国产不卡| 中文字幕 久热精品 视频在线| 国产剧情在线观看一区二区| www精品美女久久久tv| 捆绑调教一区二区三区| 精品入口麻豆88视频| 免费av网站大全久久| 欧美一区二区成人6969| 丝袜国产日韩另类美女| 91麻豆精品国产91久久久| 男男gaygay亚洲| 欧美精品一区二区在线播放| 国产精品99久久久久久似苏梦涵 | 国产精品一区二区三区99| 精品国产乱码久久久久久闺蜜| 狠狠色2019综合网| 国产亚洲欧美色| av一二三不卡影片| 亚洲综合图片区| 欧美日韩亚洲高清一区二区| 秋霞电影一区二区| 精品国精品自拍自在线| 成人中文字幕电影| 亚洲精品视频在线| 欧美日韩电影一区| 精品一区二区三区欧美| 中文字幕av一区二区三区高 | 亚洲黄色免费电影| 欧美日韩在线三区| 青草国产精品久久久久久| 欧美不卡视频一区| 成av人片一区二区| 亚洲国产一区二区a毛片| 欧美一区二区视频观看视频| 国产资源精品在线观看| 国产精品高潮呻吟| 欧美精选在线播放| 国产黄人亚洲片| 一区二区三区精品在线观看| 911国产精品| 国产精品自拍三区| 一区二区在线观看av| 日韩一区二区在线观看| 粉嫩av亚洲一区二区图片| 欧美成人高清电影在线| 久久av资源网| 国产精品乱人伦中文| 在线观看中文字幕不卡| 另类小说欧美激情| 欧美激情一区二区在线| 欧美日韩一区视频| 国产精品996| 亚洲成人av电影在线| 久久久国产午夜精品| 欧美色偷偷大香| 成人福利视频在线| 首页国产欧美久久| 国产精品入口麻豆原神| 欧美美女一区二区在线观看| 国产99久久精品| 日韩成人伦理电影在线观看| 国产精品久久三区| 日韩一区二区三区四区| 91丝袜呻吟高潮美腿白嫩在线观看| 美女高潮久久久| 亚洲一区二区三区小说| 国产欧美日韩精品a在线观看| 欧美肥胖老妇做爰| av激情成人网| 精彩视频一区二区三区| 亚洲成人午夜电影| 国产精品免费人成网站| 日韩欧美成人一区| 欧美在线一二三| aaa欧美日韩| 日韩一区欧美二区| 91精品国产色综合久久不卡蜜臀 | 欧美在线免费观看亚洲| 国产一区二区福利视频| 亚洲高清免费在线| 中文乱码免费一区二区| 日韩欧美色综合| 欧美三级日韩在线| av色综合久久天堂av综合| 激情五月激情综合网| 亚洲一区二区不卡免费| 最近日韩中文字幕| 国产午夜精品久久久久久久| 欧美一卡2卡3卡4卡| 欧美在线一区二区三区| 91女神在线视频| 懂色av中文一区二区三区| 国产真实乱子伦精品视频| 无码av免费一区二区三区试看 | 在线免费观看日本欧美| 成人av在线影院| 国产露脸91国语对白| 人人精品人人爱| 日韩中文欧美在线| 一区二区三区在线观看视频| 欧美在线制服丝袜| 色婷婷综合久久久中文一区二区| 成人综合在线观看| 韩国一区二区在线观看| 无吗不卡中文字幕| 午夜精品一区二区三区免费视频| 亚洲人亚洲人成电影网站色| 国产精品每日更新| 中文字幕精品三区| 中文在线免费一区三区高中清不卡| 久久精品欧美日韩精品 | 成人永久aaa| 成人高清视频在线观看| 成人精品一区二区三区四区| 粉嫩一区二区三区性色av| 国产成人超碰人人澡人人澡| 国产精品一品视频| 成人午夜视频网站| 成人福利视频在线看| av电影在线观看不卡 | 亚洲综合色视频| 亚洲第一综合色| 日韩精品91亚洲二区在线观看| 日韩国产精品91| 久久国产精品72免费观看| 精品午夜一区二区三区在线观看| 久99久精品视频免费观看| 国产一区欧美一区| 国产精品亚洲а∨天堂免在线| 成人综合在线观看| 99九九99九九九视频精品| 色8久久人人97超碰香蕉987| 欧美无砖专区一中文字|