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

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

?? complexbeanprobe.java

?? 本套系統采用了業界當前最為流行的beanAction組件
?? JAVA
字號:
/*
 *  Copyright 2004 Clinton Begin
 *
 *  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 com.ibatis.common.beans;

import java.lang.reflect.Method;
import java.util.Map;
import java.util.StringTokenizer;

import com.ibatis.sqlmap.engine.mapping.result.ResultObjectFactoryUtil;

/**
 * StaticBeanProbe provides methods that allow simple, reflective access to
 * JavaBeans style properties.  Methods are provided for all simple types as
 * well as object types.
 * <p/>
 * Examples:
 * <p/>
 * StaticBeanProbe.setObject(object, propertyName, value);
 * <P>
 * Object value = StaticBeanProbe.getObject(object, propertyName);
 */
public class ComplexBeanProbe extends BaseProbe {

  private static final Object[] NO_ARGUMENTS = new Object[0];

  protected ComplexBeanProbe() {
  }

  /**
   * Returns an array of the readable properties exposed by a bean
   *
   * @param object The bean
   * @return The properties
   */
  public String[] getReadablePropertyNames(Object object) {
    return ClassInfo.getInstance(object.getClass()).getReadablePropertyNames();
  }

  /**
   * Returns an array of the writeable properties exposed by a bean
   *
   * @param object The bean
   * @return The properties
   */
  public String[] getWriteablePropertyNames(Object object) {
    return ClassInfo.getInstance(object.getClass()).getWriteablePropertyNames();
  }

  /**
   * Returns the class that the setter expects to receive as a parameter when
   * setting a property value.
   *
   * @param object The bean to check
   * @param name   The name of the property
   * @return The type of the property
   */
  public Class getPropertyTypeForSetter(Object object, String name) {
    Class type = object.getClass();

    if (object instanceof Class) {
      type = getClassPropertyTypeForSetter((Class) object, name);
    } else if (object instanceof Map) {
      Map map = (Map) object;
      Object value = map.get(name);
      if (value == null) {
        type = Object.class;
      } else {
        type = value.getClass();
      }
    } else {
      if (name.indexOf('.') > -1) {
        StringTokenizer parser = new StringTokenizer(name, ".");
        while (parser.hasMoreTokens()) {
          name = parser.nextToken();
          type = ClassInfo.getInstance(type).getSetterType(name);
        }
      } else {
        type = ClassInfo.getInstance(type).getSetterType(name);
      }
    }

    return type;
  }

  /**
   * Returns the class that the getter will return when reading a property value.
   *
   * @param object The bean to check
   * @param name   The name of the property
   * @return The type of the property
   */
  public Class getPropertyTypeForGetter(Object object, String name) {
    Class type = object.getClass();

    if (object instanceof Class) {
      type = getClassPropertyTypeForGetter((Class) object, name);
    } else if (object instanceof Map) {
      Map map = (Map) object;
      Object value = map.get(name);
      if (value == null) {
        type = Object.class;
      } else {
        type = value.getClass();
      }
    } else {
      if (name.indexOf('.') > -1) {
        StringTokenizer parser = new StringTokenizer(name, ".");
        while (parser.hasMoreTokens()) {
          name = parser.nextToken();
          type = ClassInfo.getInstance(type).getGetterType(name);
        }
      } else {
        type = ClassInfo.getInstance(type).getGetterType(name);
      }
    }

    return type;
  }

  /**
   * Returns the class that the getter will return when reading a property value.
   *
   * @param type The class to check
   * @param name The name of the property
   * @return The type of the property
   */
  private Class getClassPropertyTypeForGetter(Class type, String name) {

    if (name.indexOf('.') > -1) {
      StringTokenizer parser = new StringTokenizer(name, ".");
      while (parser.hasMoreTokens()) {
        name = parser.nextToken();
        type = ClassInfo.getInstance(type).getGetterType(name);
      }
    } else {
      type = ClassInfo.getInstance(type).getGetterType(name);
    }

    return type;
  }

  /**
   * Returns the class that the setter expects to receive as a parameter when
   * setting a property value.
   *
   * @param type The class to check
   * @param name The name of the property
   * @return The type of the property
   */
  private Class getClassPropertyTypeForSetter(Class type, String name) {

    if (name.indexOf('.') > -1) {
      StringTokenizer parser = new StringTokenizer(name, ".");
      while (parser.hasMoreTokens()) {
        name = parser.nextToken();
        type = ClassInfo.getInstance(type).getSetterType(name);
      }
    } else {
      type = ClassInfo.getInstance(type).getSetterType(name);
    }

    return type;
  }

  /**
   * Gets an Object property from a bean
   *
   * @param object The bean
   * @param name   The property name
   * @return The property value (as an Object)
   */
  public Object getObject(Object object, String name) {
    if (name.indexOf('.') > -1) {
      StringTokenizer parser = new StringTokenizer(name, ".");
      Object value = object;
      while (parser.hasMoreTokens()) {
        value = getProperty(value, parser.nextToken());

        if (value == null) {
          break;
        }

      }
      return value;
    } else {
      return getProperty(object, name);
    }
  }

  /**
   * Sets the value of a bean property to an Object
   *
   * @param object The bean to change
   * @param name   The name of the property to set
   * @param value  The new value to set
   */
  public void setObject(Object object, String name, Object value) {
    if (name.indexOf('.') > -1) {
      StringTokenizer parser = new StringTokenizer(name, ".");
      String property = parser.nextToken();
      Object child = object;
      while (parser.hasMoreTokens()) {
        Class type = getPropertyTypeForSetter(child, property);
        Object parent = child;
        child = getProperty(parent, property);
        if (child == null) {
          if (value == null) {
            return; // don't instantiate child path if value is null
          } else {
            try {
              child = ResultObjectFactoryUtil.createObjectThroughFactory(type);
              setObject(parent, property, child);
            } catch (Exception e) {
              throw new ProbeException("Cannot set value of property '" + name + "' because '" + property + "' is null and cannot be instantiated on instance of " + type.getName() + ". Cause:" + e.toString(), e);
            }
          }
        }
        property = parser.nextToken();
      }
      setProperty(child, property, value);
    } else {
      setProperty(object, name, value);
    }
  }


  /**
   * Checks to see if a bean has a writable property be a given name
   *
   * @param object       The bean to check
   * @param propertyName The property to check for
   * @return True if the property exists and is writable
   */
  public boolean hasWritableProperty(Object object, String propertyName) {
    boolean hasProperty = false;
    if (object instanceof Map) {
      hasProperty = true;//((Map) object).containsKey(propertyName);
    } else {
      if (propertyName.indexOf('.') > -1) {
        StringTokenizer parser = new StringTokenizer(propertyName, ".");
        Class type = object.getClass();
        while (parser.hasMoreTokens()) {
          propertyName = parser.nextToken();
          type = ClassInfo.getInstance(type).getGetterType(propertyName);
          hasProperty = ClassInfo.getInstance(type).hasWritableProperty(propertyName);
        }
      } else {
        hasProperty = ClassInfo.getInstance(object.getClass()).hasWritableProperty(propertyName);
      }
    }
    return hasProperty;
  }

  /**
   * Checks to see if a bean has a readable property be a given name
   *
   * @param object       The bean to check
   * @param propertyName The property to check for
   * @return True if the property exists and is readable
   */
  public boolean hasReadableProperty(Object object, String propertyName) {
    boolean hasProperty = false;
    if (object instanceof Map) {
      hasProperty = true;//((Map) object).containsKey(propertyName);
    } else {
      if (propertyName.indexOf('.') > -1) {
        StringTokenizer parser = new StringTokenizer(propertyName, ".");
        Class type = object.getClass();
        while (parser.hasMoreTokens()) {
          propertyName = parser.nextToken();
          type = ClassInfo.getInstance(type).getGetterType(propertyName);
          hasProperty = ClassInfo.getInstance(type).hasReadableProperty(propertyName);
        }
      } else {
        hasProperty = ClassInfo.getInstance(object.getClass()).hasReadableProperty(propertyName);
      }
    }
    return hasProperty;
  }

  protected Object getProperty(Object object, String name) {
    ClassInfo classCache = ClassInfo.getInstance(object.getClass());
    try {
      Object value = null;
      if (name.indexOf('[') > -1) {
        value = getIndexedProperty(object, name);
      } else {
        if (object instanceof Map) {
          value = ((Map) object).get(name);
        } else {
          Method method = classCache.getGetter(name);
          if (method == null) {
            throw new NoSuchMethodException("No GET method for property " + name + " on instance of " + object.getClass().getName());
          }
          try {
            value = method.invoke(object, NO_ARGUMENTS);
          } catch (Throwable t) {
            throw ClassInfo.unwrapThrowable(t);
          }
        }
      }
      return value;
    } catch (ProbeException e) {
      throw e;
    } catch (Throwable t) {
      if (object == null) {
        throw new ProbeException("Could not get property '" + name + "' from null reference.  Cause: " + t.toString(), t);
      } else {
        throw new ProbeException("Could not get property '" + name + "' from " + object.getClass().getName() + ".  Cause: " + t.toString(), t);
      }
    }
  }

  protected void setProperty(Object object, String name, Object value) {
    ClassInfo classCache = ClassInfo.getInstance(object.getClass());
    try {
      if (name.indexOf('[') > -1) {
        setIndexedProperty(object, name, value);
      } else {
        if (object instanceof Map) {
          ((Map) object).put(name, value);
        } else {
          Method method = classCache.getSetter(name);
          if (method == null) {
            throw new NoSuchMethodException("No SET method for property " + name + " on instance of " + object.getClass().getName());
          }
          Object[] params = new Object[1];
          params[0] = value;
          try {
            method.invoke(object, params);
          } catch (Throwable t) {
            throw ClassInfo.unwrapThrowable(t);
          }
        }
      }
    } catch (ProbeException e) {
      throw e;
    } catch (Throwable t) {
      if (object == null) {
        throw new ProbeException("Could not set property '" + name + "' for null reference.  Cause: " + t.toString(), t);
      } else {
        throw new ProbeException("Could not set property '" + name + "' for " + object.getClass().getName() + ".  Cause: " + t.toString(), t);
      }
    }
  }

}


?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久综合网站| 欧美中文一区二区三区| 亚洲成人综合视频| 成人性生交大片免费看中文 | 亚洲国产综合视频在线观看| 日韩精品一区二区三区视频播放| www久久精品| 精彩视频一区二区| 蜜臀91精品一区二区三区| 五月综合激情日本mⅴ| 国产精品一级在线| 88在线观看91蜜桃国自产| 国产a视频精品免费观看| 国产欧美日韩视频在线观看| 洋洋成人永久网站入口| 亚洲黄色在线视频| 精品一区二区三区不卡 | 1024国产精品| 成人国产精品免费网站| 国精产品一区一区三区mba桃花| 国产成人欧美日韩在线电影| 欧美zozo另类异族| 亚洲大片免费看| 欧美精品日韩一本| 6080亚洲精品一区二区| 欧美群妇大交群的观看方式| 中文字幕一区二区在线观看| 久久精品国产网站| 欧美日韩在线电影| 国产资源精品在线观看| 亚洲色图在线看| 日韩成人免费看| 日韩一区和二区| 久久精品噜噜噜成人88aⅴ| 99久久婷婷国产综合精品电影| 最新不卡av在线| 欧美一区日本一区韩国一区| 中文字幕欧美区| 一区二区成人在线| 成人国产精品免费观看动漫| 久久九九国产精品| 成人免费的视频| 开心九九激情九九欧美日韩精美视频电影 | 国产喂奶挤奶一区二区三区| 懂色av一区二区三区免费看| 91精品久久久久久久久99蜜臂| 一区二区中文视频| 成人黄色免费短视频| 成人综合在线视频| 丝袜美腿亚洲一区| 国产亚洲成aⅴ人片在线观看| 日韩激情中文字幕| 亚洲欧美一区二区不卡| 亚洲国产美国国产综合一区二区| 91蜜桃婷婷狠狠久久综合9色| 国产精品亚洲一区二区三区妖精| 蜜乳av一区二区三区| 偷拍一区二区三区| 一本到不卡免费一区二区| 日韩中文字幕区一区有砖一区| 日本一区二区三区免费乱视频 | 国产一区二区三区在线观看免费 | 精品视频色一区| 一区二区免费看| 亚洲视频在线观看一区| 久久久久久综合| 成人精品国产福利| 国产一区二区三区免费| 亚洲国产wwwccc36天堂| 亚洲欧美日韩系列| 一区二区三区中文在线观看| 国产精品国模大尺度视频| 国产日产欧美精品一区二区三区| 精品国产在天天线2019| 欧美在线你懂得| 在线看国产一区| 欧美午夜在线观看| 日本高清成人免费播放| 国产欧美综合在线| 中文字幕一区二区三区视频| 在线播放视频一区| 在线观看日韩国产| 欧美日韩一区在线观看| 欧美系列亚洲系列| 日韩一区二区三区精品视频| 久久精品一区二区三区不卡 | 91蝌蚪porny九色| 国产综合久久久久久鬼色| 久久福利视频一区二区| 日本不卡的三区四区五区| 另类小说视频一区二区| 精品国免费一区二区三区| 久久久久久一级片| 国产精品久久久久久久久免费丝袜| 中文字幕欧美国产| 亚洲国产色一区| 日产国产欧美视频一区精品| 91视频在线看| 国产一区二区不卡在线| 成人午夜电影网站| 欧美丰满嫩嫩电影| 1000精品久久久久久久久| 丝袜诱惑亚洲看片| 精品一区二区三区免费播放| 日韩欧美一区二区三区在线| 婷婷六月综合亚洲| 激情文学综合丁香| 91激情在线视频| 国产精品久久毛片a| 久久超级碰视频| 欧美午夜在线一二页| 日韩毛片精品高清免费| 精品噜噜噜噜久久久久久久久试看| 一区二区三区四区精品在线视频| 国产一区二区三区四区五区入口| 欧美在线免费视屏| 亚洲乱码国产乱码精品精小说| 国产精品一区二区免费不卡| 欧美精品久久一区| 精品国精品自拍自在线| 夜夜嗨av一区二区三区中文字幕| 奇米精品一区二区三区在线观看| 日韩小视频在线观看专区| 免费在线视频一区| 欧美一区二区三区视频在线观看 | 日韩女优电影在线观看| 国产精品私人影院| 不卡的av电影在线观看| 久久久综合精品| 蜜臀久久久久久久| 欧美va亚洲va| 欧美精品日韩一区| www国产精品av| 免费高清在线视频一区·| 9191国产精品| 日韩国产精品91| 精品成人一区二区| 成人激情免费电影网址| 国产精品女主播在线观看| 91丨porny丨国产入口| 欧美日韩卡一卡二| 午夜久久福利影院| 日韩一级在线观看| 国产一区二区网址| 亚洲人xxxx| 久久综合中文字幕| 99热这里都是精品| 亚洲午夜精品网| 欧美精品少妇一区二区三区| 亚洲人成7777| 国产亚洲精品7777| 日韩一区二区三区视频| 色婷婷综合五月| 狠狠色丁香九九婷婷综合五月| 亚洲欧美一区二区久久| 91精品国产福利在线观看| 色婷婷精品久久二区二区蜜臂av| 久久影音资源网| 91精品免费在线| 91浏览器入口在线观看| 国产在线播精品第三| 亚洲一卡二卡三卡四卡| 国产精品丝袜在线| 久久久久免费观看| 91久久精品一区二区三区| 麻豆精品新av中文字幕| 欧美综合一区二区| 日本美女一区二区三区| √…a在线天堂一区| 久久综合九色综合久久久精品综合| 国产精品18久久久久久久网站| 日日嗨av一区二区三区四区| 亚洲六月丁香色婷婷综合久久 | 亚洲高清久久久| 国产精品美女视频| 国产精品高潮呻吟| 久久毛片高清国产| 国产精品国产三级国产有无不卡| 国产欧美视频在线观看| 亚洲欧美另类在线| 久久午夜色播影院免费高清 | 亚洲人一二三区| 久久久精品2019中文字幕之3| 精品入口麻豆88视频| 91免费版pro下载短视频| 成人精品在线视频观看| 国产精品99精品久久免费| 成人亚洲一区二区一| 成人综合婷婷国产精品久久蜜臀| 久久精品国产亚洲a| av亚洲精华国产精华精华 | 久久精品网站免费观看| 国产精品久久久久久久浪潮网站 | 国模冰冰炮一区二区| 国产伦精一区二区三区| 麻豆成人91精品二区三区| 成人国产精品免费网站| 欧美日韩视频专区在线播放| 久久这里只有精品6| 中文一区二区在线观看|