52.Apache Project &.../Apache Commons

The BeanUtils Component

1010 2009. 3. 4. 15:34
반응형
The BeanUtils Component

대부분의 자바 개발자들은 객체 속성의 getters와 setters에 대한 자바빈즈 네이밍 패턴에 따르는 자바 클래스들을 만들곤 한다. 이러한 상호대응하는 getXxx 와 setXxx 메소드들를 호출하는 방식으로 직접 이들 메소드들에 접근함은 자연스럽다. 그러나 자바 객체 속성들에 대한 동적인 접근이 필요한 경우가 종종 발생한다.(호출되는 속성 getter 와 setter 메소드들의 compiled-in 지식없이) . 다음과 같은 경우들이 이에 포함된다.

  • 자바 오브젝트 모델과 상호 작용하는 스크립팅 언어를 개발할 때 (such as the Bean Scripting Framework).
  • 웹 프레이젠테이션과 같은 템프릿 언어 프로세스를 개발할 때 (such as JSP or Velocity).
  • JSP와 XSP 환경을 위한 커스텀 태그 라이버러리를 개발할 때 (such as Jakarta Taglibs, Struts, Cocoon).
  • XML-based 구성(configuration) 자원을 활용할 때 (such as Ant build scripts, web application deployment descriptors, Tomcat's server.xml file).

자바 언어는 ReflectionIntrospection API들을 제공한다.(JDK Javadoc 안의 java.lang.reflect 과 java.beans 패키지를 보라). 그러나, 이들 API들은 이해하고 활용하기에 매우 복잡해질 수 있다. BeanUtils 콤프넌트는 이들의 능력을 쉽게 사용할 수 있도록 랩퍼들을 제공한다


문서

Release Notes 는 이 배포판에 포함되어 있는 새로운 기능과 버그 픽스를 문서로 정리하고 있다.

JavaDoc API documents 는 online상에서 가능하다. 특히, PropertyUtils 클래스 설명서에 기술된 속성 참조 신택스 옵션들에 주의해야 한다.


배포판



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:

  • Building scripting languages that interact with the Java object model (such as the Bean Scripting Framework).
  • Building template language processors for web presentation and similar uses (such as JSP or Velocity).
  • Building custom tag libraries for JSP and XSP environments (such as Jakarta Taglibs, Struts, Cocoon).
  • Consuming XML-based configuration resources (such as Ant build scripts, web application deployment descriptors, Tomcat's server.xml file).

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.

BeanUtils Core And Modules

Since the 1.7.0 release BeanUtils has distributed three jars:

  • commons-beanutils.jar - contains everything
  • commons-beanutils-core.jar - excludes Bean Collections classes
  • commons-beanutils-bean-collections.jar - only Bean Collections classes
The main commons-beanutils.jar has an optional dependency on Commons Collections

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 Collections has an additional dependency on Commons Collections .

Documentation

The User Guide is part of the package JavaDocs.

The Release Notes document the new features and bug fixes that have been included in this release.

The JavaDoc API documents are available online. In particular, you should note the property reference syntax options described in the PropertyUtils class description.

Releases

1.8.0

BeanUtils 1.8.0 is binary compatible with version 1.7.0 and contains quite a few bug fixes and enhancements .

BeanUtils 1.8.0 is available to download here .

1.7.0

BeanUtils 1.7.0 is a service release which removes the dependency upon a specific commons-collection library version. It may be safely used together with either the 2.x or 3.x series of commons-collections releases. It also introduces a number of important enhancements. It is backward compatible with the 1.6 release.

This important service release is intended to help downstream applications solve dependency issues. The dependency on commons collections (which has become problematic now that there are two incompatible series of commons collections releases) has been factored into a separate optional sub-component plus a small number of stable and mature org.apache.commons.collections packaged classes (which are distributed with the BeanUtils core). This arrangement means that the BeanUtils core sub-component (which is the primary dependency for most downsteam applications) can now be safely included on the same classpath as commons collections 2.x, 3.x or indeed neither.

The distribution now contains alternative jar sets. The all-in-one jar contains all classes. The modular jar set consists of a core jar dependent only on commons logging and an optional bean collections jar (containing classes that provide easy and efficient ways to manage collections of beans) which depends on commons collections 3.

BeanUtils 1.7.0 is available to download here .

Older Releases (Not Mirrored)

Support

The commons mailing lists act as the main support forum. The user list is suitable for most library usage queries. The dev list is intended for the development discussion. Please remember that the lists are shared between all commons components, so prefix your email by [beanutils].

Issues may be reported via ASF JIRA .