Commons BeanUtils 初识

Commons BeanUtils

      Most Java developers are used to creating Java classes that conform to the JavaBeans naming patterns for property getters and setters. It is natural to then access these methods directly, using calls to the corresponding getXxx and setXxx methods. However, there are some occasions where dynamic access to Java object properties (without compiled-in knowledge of the property getter and setter methods to be called) is needed. Example use cases include:

      大多数Java开发人员习惯于创建符合JavaBeans属性getter和setter命名模式的Java类。然后使用对相应的getXxxsetXxx方法的调用直接访问这些方法是很自然的 但是,在某些情况下,需要动态访问Java对象属性(不需要调用属性getter和setter方法的编译知识)。用例示例包括:

  • Building scripting languages that interact with the Java object model (such as the Bean Scripting Framework).  
  • 构建与Java对象模型(例如Bean Scripting Framework)交互的脚本语言。
  • Building template language processors for web presentation and similar uses (such as JSP or Velocity).                  
  • 构建用于Web演示和类似用途的模板语言处理器(例如JSP或Velocity)。
  • Building custom tag libraries for JSP and XSP environments (such as Jakarta Taglibs, Struts, Cocoon). 
  •  为JSP和XSP环境构建自定义标记库(例如Jakarta Taglibs,Struts,Cocoon)。
  • Consuming XML-based configuration resources (such as Ant build scripts, web application deployment descriptors, Tomcat's server.xml file). 
  •  使用基于XML的配置资源(例如Ant构建脚本,Web应用程序部署描述符,Tomcat的server.xml 文件)。

      The Java language provides Reflection and Introspection APIs (see the java.lang.reflect and java.beans packages in the JDK Javadocs). However, these APIs can be quite complex to understand and utilize. The BeanUtils component provides easy-to-use wrappers around these capabilities.

      Java语言提供了ReflectionIntrospection API(请参阅 JDK Javadocs中java.lang.reflectjava.beans包)。但是,这些API可能非常复杂,无法理解和利用。该 BeanUtils的组件提供围绕这些功能易于使用的包装。


BeanUtils Core And Modules    BeanUtils核心和模块

The 1.7.x and 1.8.x releases of BeanUtils have distributed three jars:

  • commons-beanutils.jar - contains everything  所有 
  • commons-beanutils-core.jar - excludes Bean Collections classes   排除Bean Collections
  • commons-beanutils-bean-collections.jar - only Bean Collections classes   
The main  commons-beanutils.jar has an  optional dependency on  Commons Collections  
 commons-beanutils.jar Commons Collections有一个 可选的 依赖

      Version 1.9.0 reverts this split for reasons outlined at BEANUTILS-379. There is now only one jar for the BeanUtils library.

     版本1.9.0由于BEANUTILS-379中概述的原因而恢复此拆分 BeanUtils库现在只有一个jar。

Bean Collections

      Bean collections is a library combining BeanUtils with Commons Collections to provide services for collections of beans. One class (BeanComparator) was previously released, the rest are new. This new distribution strategy should allow this sub-component to evolve naturally without the concerns about size and scope that might otherwise happen.

      Bean集合是一个将BeanUtils与Commons集合相结合的库,用于为Bean集合提供服务。一个类(BeanComparator)以前发布过,其他类是新的。这种新的分发策略应该允许这个子组件自然地发展,而不需要担心可能发生的规模和范围。

      Bean Collections has an additional dependency on Commons Collections.

        Bean Collections还对Commons Collections有额外的依赖性 

Releases

1.9.x releases

      BeanUtils 1.9.x releases are binary compatible (with a minor exception described in the release notes) with version 1.8.3 and require a minimum of JDK 1.5.

      BeanUtils 1.9.x版本与版本1.8.3是二进制兼容的(在发行说明中描述了一个小的例外),并且要求至少JDK 1.5。

The latest BeanUtils release is available to download here.

猜你喜欢

转载自blog.csdn.net/qq_30336433/article/details/81030975
今日推荐