Home » Core Java » beans

beans

Bean XML deserialization

With this example we are going to demonstrate how to deserialize a java Bean using the XMLDecoder. The XMLDecoder class is used to read XML documents created using the XMLEncoder and is used just like the ObjectInputStream. In short, to deserialize a java Bean using the XMLDecoder you should: Create an xml representation of the java bean. Create a simple ...

Read More »

Bean XML serialization

This is an example of how to serialize a java Bean using the XMLEncoder. The XMLEncoder class is a complementary alternative to the ObjectOutputStream and can used to generate a textual representation of a JavaBean in the same way that the ObjectOutputStream can be used to create binary representation of Serializable objects. Serializing a java Bean using the XMLEncoder implies ...

Read More »

Bean property change event listener

In this example we shall show you how to change a Bean’s property using an event listener. We will use the PropertyChangeListener interface. This interface can be registered with a bean so as to be notified of any bound property updates. We are also using the PropertyChangeSupport class. This is a utility class that can be used by beans that ...

Read More »

List bean property names

With this example we are going to demonstrate how to list the names of a bean’s properties. We are using the PropertyDescriptor, a class that describes one property that a Java Bean exports via a pair of accessor methods. We are also using the Introspector class, that provides a standard way for tools to learn about the properties, events, and ...

Read More »

Get/Set a bean property

This is an example of how to get and set a bean property. We are using the Statement class. A Statement object represents a primitive statement in which a single method is applied to a target and a set of arguments. In order to get and set a bean property you should: Create a simple class, like Bean class in ...

Read More »

Want to take your Java skills to the next level?

Grab our programming books for FREE!

Here are some of the eBooks you will get:

  • Spring Interview QnA
  • Multithreading & Concurrency QnA
  • JPA Minibook
  • JVM Troubleshooting Guide
  • Advanced Java
  • Java Interview QnA
  • Java Design Patterns