Apache Commons BeanUtils

Last updated
Apache Commons BeanUtils
Developer(s) Apache Software Foundation
Stable release
1.9.4
Repository https://github.com/apache/commons-beanutils
Written in Java
Operating system Cross-platform
License Apache License 2.0
Website commons.apache.org/proper/commons-beanutils/index.html

Apache Commons BeanUtils is a Java-based utility to provide component based architecture. [1] [2] [3]

Contents

Modules

The library is distributed in three jar files:

Example

Sample code may look like as follows:

/*** Example displaying the new default behaviour such that* it is not possible to access class level properties utilizing the* BeanUtilsBean, which in turn utilizes the PropertyUtilsBean.*/publicvoidtestSuppressClassPropertyByDefault()throwsException{finalBeanUtilsBeanbub=newBeanUtilsBean();finalAlphaBeanbean=newAlphaBean();try{bub.getProperty(bean,"class");fail("Could access class property!");}catch(finalNoSuchMethodExceptionex){// ok}}/*** Example showing how by which one would use to revert to the* behaviour prior to the 1.9.4 release where class level properties were accessible by* the BeanUtilsBean and the PropertyUtilsBean.*/publicvoidtestAllowAccessToClassProperty()throwsException{finalBeanUtilsBeanbub=newBeanUtilsBean();bub.getPropertyUtils().removeBeanIntrospector(SuppressPropertiesBeanIntrospector.SUPPRESS_CLASS);finalAlphaBeanbean=newAlphaBean();Stringresult=bub.getProperty(bean,"class");assertEquals("Class property should have been accessed","class org.apache.commons.beanutils2.AlphaBean",result);}

[1]

See also

Related Research Articles

Abstract factory pattern term in software development

The abstract factory pattern provides a way to encapsulate a group of individual factories that have a common theme without specifying their concrete classes. In normal usage, the client software creates a concrete implementation of the abstract factory and then uses the generic interface of the factory to create the concrete objects that are part of the theme. The client does not know which concrete objects it gets from each of these internal factories, since it uses only the generic interfaces of their products. This pattern separates the details of implementation of a set of objects from their general usage and relies on object composition, as object creation is implemented in methods exposed in the factory interface.

Java Platform, Standard Edition is a computing platform for development and deployment of portable code for desktop and server environments. Java SE was formerly known as Java 2 Platform, Standard Edition (J2SE).

In object-oriented programming, the iterator pattern is a design pattern in which an iterator is used to traverse a container and access the container's elements. The iterator pattern decouples algorithms from containers; in some cases, algorithms are necessarily container-specific and thus cannot be decoupled.

In software engineering, the mediator pattern defines an object that encapsulates how a set of objects interact. This pattern is considered to be a behavioral pattern due to the way it can alter the program's running behavior.

JAR (file format) archive file format

A JAR is a package file format typically used to aggregate many Java class files and associated metadata and resources into one file for distribution.

Apache Ant software tool for automating software build processes

Apache Ant is a software tool for automating software build processes which originated from the Apache Tomcat project in early 2000. It was a replacement for the Make build tool of Unix, and was created due to a number of problems with Unix's make. It is similar to Make but is implemented using the Java language, requires the Java platform, and is best suited to building Java projects.

NUnit

NUnit is an open-source unit testing framework for the .NET Framework and Mono. It serves the same purpose as JUnit does in the Java world, and is one of many programs in the xUnit family.

Java syntax

The syntax of the Java refers to the set of rules defining how a Java program is written and interpreted.

In computing based on the Java Platform, JavaBeans are classes that encapsulate many objects into a single object. They are serializable, have a zero-argument constructor, and allow access to properties using getter and setter methods. The name "Bean" was given to encompass this standard, which aims to create reusable software components for Java.

Maven is a build automation tool used primarily for Java projects. Maven can also be used to build and manage projects written in C#, Ruby, Scala, and other languages. The Maven project is hosted by the Apache Software Foundation, where it was formerly part of the Jakarta Project.

In the Java computer programming language, an annotation is a form of syntactic metadata that can be added to Java source code. Classes, methods, variables, parameters and Java packages may be annotated. Like Javadoc tags, Java annotations can be read from source files. Unlike Javadoc tags, Java annotations can also be embedded in and read from Java class files generated by the Java compiler. This allows annotations to be retained by the Java virtual machine at run-time and read via reflection. It is possible to create meta-annotations out of the existing ones in Java.

JavaMail is a Java API used to send and receive email via SMTP, POP3 and IMAP. JavaMail is built into the Java EE platform, but also provides an optional package for use in Java SE.

Jspx-bay

jspx-bay, commonly referred to as jspx, is a free open source pure Java web RAD framework. Jspx should not be confused with other technologies using the same name like Oracle Application Framework and XML JSP.

Hector is a high-level client API for Apache Cassandra. Named after Hector, a warrior of Troy in Greek mythology, it is a substitute for the Cassandra Java Client, or Thrift, that is encapsulated by Hector. It also has Maven repository access.

Evocb

EVO/CB is a distributed object system that is constructed on top of publish/subscribe event systems. This design decision implies modeling method calls as events and subscriptions over the underlying messaging middleware.

Composite entity is a Java EE Software design pattern and it is used to model, represent, and manage a set of interrelated persistent objects rather than representing them as individual fine-grained entity beans, and also a composite entity bean represents a graph of objects.

Apache Commons Logging is a Java-based logging utility and a programming model for logging and for other toolkits. It provides APIs, log implementations, and wrapper implementations over some other tools.

The Java programming language's Java Collections Framework version 1.5 and later defines and implements the original regular single-threaded Maps, and also new thread-safe Maps implementing the java.util.concurrent.ConcurrentMapinterface among other concurrent interfaces. In Java 1.6, the java.util.NavigableMap interface was added, extending java.util.SortedMap, and the java.util.concurrent.ConcurrentNavigableMap interface was added as a subinterface combination.

Business delegate is a Java EE design pattern. This pattern is directing to reduce the coupling in between business services and the connected presentation tier, and to hide the implementation details of services. Business delegates acts as an adaptor to invoke business objects from the presentation tier.

References

  1. 1 2 3 "BeanUtils – Commons". commons.apache.org. Retrieved 2019-08-20.
  2. Berglund, Tim; McCullough, Matthew (2011-07-13). Building and Testing with Gradle. "O'Reilly Media, Inc.". p. 57. ISBN   9781449304638.
  3. Company, Sonatype (2008-09-24). Maven: The Definitive Guide: The Definitive Guide. "O'Reilly Media, Inc.". p. 136. ISBN   9780596551780.