English 中文(简体)
WrapDynaBean
  • 时间:2024-12-22

Java BeanUtils - WrapDynaBean


Previous Page Next Page  

Description

As we have seen in the previous chapters, DynaBeans APIs provides get() and set() methods to access simple, indexed and mapped properties of DynaBeans dynamically. Instead of this, you can use the existing standard JavaBeans classes to access all beans by using the WrapDynaBean and WrapDynaClass. As the name itself indicates WrapDynaBean class is used to wrap the DynaBean APIs throughout the existing JavaBean class.

To make use of the WrapDynaBean class, create the wrapper as shown in the below simple code:

BeanDemo bean = ...;
DynaBean wrapper = new WrapDynaBean(bean);
String yourName = wrapper.get("yourName");
Advertisements