当前位置: 首页 > news >正文

国外网站打开速度慢的原因c 做网站需要什么知识

国外网站打开速度慢的原因,c 做网站需要什么知识,北京网站建设推,网页设计教程 表单一、前言基于spring-beans(4.1.4)的工具类org.springframework.beans.BeanUtils对注入spring对象按照Class实例化instantiateClass、class对象方法名称methodName查找findMethod、属性查找对于class类信息findPropertyType、对象属性复制copyProperties等常用操作#xff0c;具…一、前言基于spring-beans(4.1.4)的工具类org.springframework.beans.BeanUtils对注入spring对象按照Class实例化instantiateClass、class对象方法名称methodName查找findMethod、属性查找对于class类信息findPropertyType、对象属性复制copyProperties等常用操作具体如下源码所示。二、源码说明package org.springframework.beans;bbimport java.beans.PropertyDescriptor;bimport java.beans.PropertyEditor;bimport java.lang.reflect.Constructor;bimport java.lang.reflect.InvocationTargetException;bimport java.lang.reflect.Method;bimport java.lang.reflect.Modifier;bimport java.net.URI;bimport java.net.URL;bimport java.util.Arrays;bimport java.util.Collections;bimport java.util.Date;bimport java.util.List;bimport java.util.Locale;bimport java.util.Set;bimport org.apache.commons.logging.Log;bimport org.apache.commons.logging.LogFactory;bimport org.springframework.core.MethodParameter;bimport org.springframework.util.Assert;bimport org.springframework.util.ClassUtils;bimport org.springframework.util.ConcurrentReferenceHashMap;bimport org.springframework.util.ReflectionUtils;bimport org.springframework.util.StringUtils;bbpublic abstract class BeanUtilsb{b  private static final Log logger  LogFactory.getLog(BeanUtils.class);b  private static final Set unknownEditorTypes  Collections.newSetFromMap(new ConcurrentReferenceHashMap(64));bb  public static  T instantiate(Class clazz)b    throws BeanInstantiationExceptionb  {b    Assert.notNull(clazz, Class must not be null);b    if (clazz.isInterface())b      throw new BeanInstantiationException(clazz, Specified class is an interface);b    tryb    {b      return clazz.newInstance();b    }b    catch (InstantiationException ex) {b      throw new BeanInstantiationException(clazz, Is it an abstract class?, ex);b    }b    catch (IllegalAccessException ex) {b      throw new BeanInstantiationException(clazz, Is the constructor accessible?, ex);b    }b  }bb  public static  T instantiateClass(Class clazz)b    throws BeanInstantiationExceptionb  {b    Assert.notNull(clazz, Class must not be null);b    if (clazz.isInterface())b      throw new BeanInstantiationException(clazz, Specified class is an interface);b    tryb    {b      return instantiateClass(clazz.getDeclaredConstructor(new Class[0]), new Object[0]);b    }b    catch (NoSuchMethodException ex) {b      throw new BeanInstantiationException(clazz, No default constructor found, ex);b    }b  }bb  public static  T instantiateClass(Class clazz, Class assignableTo)b    throws BeanInstantiationExceptionb  {b    Assert.isAssignable(assignableTo, clazz);b    return instantiateClass(clazz);b  }bb  public static  T instantiateClass(Constructor ctor, Object[] args)b    throws BeanInstantiationExceptionb  {b    Assert.notNull(ctor, Constructor must not be null);b    try {b      ReflectionUtils.makeAccessible(ctor);b      return ctor.newInstance(args);b    }b    catch (InstantiationException ex) {b      throw new BeanInstantiationException(ctor.getDeclaringClass(), Is it an abstract class?, ex);b    }b    catch (IllegalAccessException ex)b    {b      throw new BeanInstantiationException(ctor.getDeclaringClass(), Is the constructor accessible?, ex);b    }b    catch (IllegalArgumentException ex)b    {b      throw new BeanInstantiationException(ctor.getDeclaringClass(), Illegal arguments for constructor, ex);b    }b    catch (InvocationTargetException ex)b    {b      throw new BeanInstantiationException(ctor.getDeclaringClass(), Constructor threw exception, exb        .getTargetException());b    }b  }bb  public static Method findMethod(Class clazz, String methodName, Class[] paramTypes)b  {b    tryb    {b      return clazz.getMethod(methodName, paramTypes);b    } catch (NoSuchMethodException ex) {b    }b    return findDeclaredMethod(clazz, methodName, paramTypes);b  }bb  public static Method findDeclaredMethod(Class clazz, String methodName, Class[] paramTypes)b  {b    tryb    {b      return clazz.getDeclaredMethod(methodName, paramTypes);b    }b    catch (NoSuchMethodException ex) {b      if (clazz.getSuperclass() ! null)b        return findDeclaredMethod(clazz.getSuperclass(), methodName, paramTypes);b    }b    return null;b  }bb  public static Method findMethodWithMinimalParameters(Class clazz, String methodName)b    throws IllegalArgumentExceptionb  {b    Method targetMethod  findMethodWithMinimalParameters(clazz.getMethods(), methodName);b    if (targetMethod  null)b      targetMethod  findDeclaredMethodWithMinimalParameters(clazz, methodName);bb    return targetMethod;b  }bb  public static Method findDeclaredMethodWithMinimalParameters(Class clazz, String methodName)b    throws IllegalArgumentExceptionb  {b    Method targetMethod  findMethodWithMinimalParameters(clazz.getDeclaredMethods(), methodName);b    if ((targetMethod  null)  (clazz.getSuperclass() ! null))b      targetMethod  findDeclaredMethodWithMinimalParameters(clazz.getSuperclass(), methodName);bb    return targetMethod;b  }bb  public static Method findMethodWithMinimalParameters(Method[] methods, String methodName)b    throws IllegalArgumentExceptionb  {b    Method targetMethod  null;b    int numMethodsFoundWithCurrentMinimumArgs  0;b    Method[] arrayOfMethod  methods; int i  arrayOfMethod.length; for (int j  0; j  1) {b      throw new IllegalArgumentException(Cannot resolve method   methodName   to a unique method. Attempted to resolve to overloaded method with   the least number of parameters, but there were   numMethodsFoundWithCurrentMinimumArgs   candidates.);b    }bb    return targetMethod;b  }bb  public static Method resolveSignature(String signature, Class clazz)b  {b    Assert.hasText(signature, signature must not be empty);b    Assert.notNull(clazz, Class must not be null);b    int firstParen  signature.indexOf(();b    int lastParen  signature.indexOf());b    if ((firstParen  -1)  (lastParen  -1)) {b      throw new IllegalArgumentException(Invalid method signature   signature  : expected closing ) for args list);b    }bb    if ((lastParen  -1)  (firstParen  -1)) {b      throw new IllegalArgumentException(Invalid method signature   signature  : expected opening ( for args list);b    }bb    if ((firstParen  -1)  (lastParen  -1)) {b      return findMethodWithMinimalParameters(clazz, signature);b    }bb    String methodName  signature.substring(0, firstParen);bb    String[] parameterTypeNames  StringUtils.commaDelimitedListToStringArray(signatureb      .substring(firstParen  1, lastParen));bb    Class[] parameterTypes  new Class[parameterTypeNames.length];b    for (int i  0; i  clazz)b    throws BeansExceptionb  {b    CachedIntrospectionResults cr  CachedIntrospectionResults.forClass(clazz);b    return cr.getPropertyDescriptors();b  }bb  public static PropertyDescriptor getPropertyDescriptor(Class clazz, String propertyName)b    throws BeansExceptionb  {b    CachedIntrospectionResults cr  CachedIntrospectionResults.forClass(clazz);b    return cr.getPropertyDescriptor(propertyName);b  }bb  public static PropertyDescriptor findPropertyForMethod(Method method)b    throws BeansExceptionb  {b    return findPropertyForMethod(method, method.getDeclaringClass());b  }bb  public static PropertyDescriptor findPropertyForMethod(Method method, Class clazz)b    throws BeansExceptionb  {b    Assert.notNull(method, Method must not be null);b    PropertyDescriptor[] pds  getPropertyDescriptors(clazz);b    PropertyDescriptor[] arrayOfPropertyDescriptor1  pds; int i  arrayOfPropertyDescriptor1.length; for (int j  0; j  targetType)b  {b    if ((targetType  null) || (targetType.isArray()) || (unknownEditorTypes.contains(targetType)))b      return null;bb    ClassLoader cl  targetType.getClassLoader();b    if (cl  null)b      try {b        cl  ClassLoader.getSystemClassLoader();b        if (cl  null)b          return null;bb      }b      catch (Throwable ex)b      {b        if (logger.isDebugEnabled())b          logger.debug(Could not access system ClassLoader:   ex);bb        return null;b      }bb    String editorName  targetType.getName()  Editor;b    try {b      Class editorClass  cl.loadClass(editorName);b      if (!(PropertyEditor.class.isAssignableFrom(editorClass))) {b        if (logger.isWarnEnabled()) {b          logger.warn(Editor class [  editorName  ] does not implement [java.beans.PropertyEditor] interface);b        }bb        unknownEditorTypes.add(targetType);b        return null;b      }b      return ((PropertyEditor)instantiateClass(editorClass));b    }b    catch (ClassNotFoundException ex) {b      if (logger.isDebugEnabled())b        logger.debug(No property editor [  editorName  ] found for type   targetTypeb          .getName()   according to Editor suffix convention);bb      unknownEditorTypes.add(targetType); }b    return null;b  }bb  public static Class findPropertyType(String propertyName, Class[] beanClasses)b  {b    Class[] arrayOfClass;b    int j;b    if (beanClasses ! null) {b      arrayOfClass  beanClasses; int i  arrayOfClass.length; for (j  0; j  clazz)b  {b    Assert.notNull(clazz, Class must not be null);b    return ((isSimpleValueType(clazz)) || ((clazz.isArray())  (isSimpleValueType(clazz.getComponentType()))));b  }bb  public static boolean isSimpleValueType(Class clazz)b  {b    return ((ClassUtils.isPrimitiveOrWrapper(clazz)) || (clazz.isEnum()) || b      (CharSequence.classb      .isAssignableFrom(clazz)) || b      (Number.classb      .isAssignableFrom(clazz)) || b      (Date.classb      .isAssignableFrom(clazz)) || b      (clazzb      .equals(URI.class)) || b      (clazz.equals(URL.class)) || b      (clazzb      .equals(Locale.class)) || b      (clazz.equals(Class.class)));b  }bb  public static void copyProperties(Object source, Object target)b    throws BeansExceptionb  {b    copyProperties(source, target, null, (String[])null);b  }bb  public static void copyProperties(Object source, Object target, Class editable)b    throws BeansExceptionb  {b    copyProperties(source, target, editable, (String[])null);b  }bb  public static void copyProperties(Object source, Object target, String[] ignoreProperties)b    throws BeansExceptionb  {b    copyProperties(source, target, null, ignoreProperties);b  }bb  private static void copyProperties(Object source, Object target, Class editable, String[] ignoreProperties)b    throws BeansExceptionb  {b    Assert.notNull(source, Source must not be null);b    Assert.notNull(target, Target must not be null);bb    Class actualEditable  target.getClass();b    if (editable ! null) {b      if (!(editable.isInstance(target)))b      {b        throw new IllegalArgumentException(Target class [  target.getClass().getName()  ] not assignable to Editable class [  editableb          .getName()  ]);b      }b      actualEditable  editable;b    }b    PropertyDescriptor[] targetPds  getPropertyDescriptors(actualEditable);b    List ignoreList  (ignoreProperties ! null) ? Arrays.asList(ignoreProperties) : null;bb    PropertyDescriptor[] arrayOfPropertyDescriptor1  targetPds; int i  arrayOfPropertyDescriptor1.length; for (int j  0; j
http://wiki.neutronadmin.com/news/81974/

相关文章:

  • 哈尔滨速成网站建设火车头采集器wordpress发布模块
  • 学习网站建设0学起前端优化网站
  • 龙湖地产 网站建设商城网站怎么做优化
  • 怎么更改网站里的tdk源码上传网站
  • 商会网站设计上海广告公司
  • 国际物流东莞网站建设装潢公司网站设计与制作
  • 学院网站建设申请报告中国最大的建站网站
  • 网站优化一年多少钱互联网保险公司有几家
  • 百度云搜索引擎网站网站建设的细节处理
  • 加盟类网站怎么做做一网站需要多少钱
  • 北京三屏网站制作网站内链优化的角度
  • 一般网站建设流程有哪些步骤page文件怎么转换wordpress
  • 十堰市住房和城乡建设厅官方网站互联网公司怎么盈利
  • 做网站需要什么证件吗正规的锦州网站建设
  • 网站建设项目国内外分析报告wordpress前台很慢
  • p2p网站开发维护wordpress 微信 权限
  • 怎样做免费网站推广网站空间多大合适
  • 外贸soho虚拟公司做网站wordpress 页面 评论链接 新窗口打开
  • 河南省和建设厅网站首页免费网站建设咨询
  • 青岛手机网站建设南宁网络推广方案
  • 番禺商城网站建设最大的地方门户网站源码
  • 大学生网站开发总结报告如何给国外网站做seo
  • 做网站号码wordpress 商务
  • 国外空间网站3建设营销型网站流程图
  • 贵港网站seo织梦音乐网站模板
  • 海淘网站主要关键词旺道seo系统
  • 阿里云网站建设——部署与发布wordpress黄聪
  • 珠海市网站设计公司apache wordpress配置
  • asp.net网站开发介绍视频网站如何推广
  • 手机app 网站建设台州免费做网站