SupportWriter space ↗
REFERENCE LIBRARY

References from other publishers

Republished articles with source attribution. This collection is separate from Diary Coding’s original guides and does not display ads.

Read original guides → · Editorial policy

FOR YOUR CURIOSITY

Latest notes.

BEANS / NOTES</>↗
Beans24 Jun 2008

How do I list property names of a Bean?

package org.kodejava.bean; import java.io.Serializable; import java.beans.BeanInfo; import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.beans.IntrospectionException; public class Fruit implements Serializable { private Long id; private String name; private String latinName; private double price; public Fruit() { } public static void main(String[] args) { try { BeanInfo bi = Introspector.getBeanInfo(Fruit.class); PropertyDescriptor[] pds = bi.getP...

Wayan · 1 min read
BEANS / NOTES</>↗
Beans20 Jun 2008

How do I create an instance of a Bean?

package org.kodejava.bean; import java.io.Serializable; import java.io.IOException; import java.beans.Beans; public class TheBean implements Serializable { private Long id; private String name; public TheBean() { } public static void main(String[] args) { try { TheBean bean = (TheBean) Beans.instantiate( ClassLoader.getSystemClassLoader(), "org.kodejava.bean.TheBean"); bean.setId(1L); bean.setName("John"); System.out.println("The Bean = " + bean); } catch (IOException | Class...

Wayan · 1 min read
BEANS / NOTES</>↗
Beans16 Jun 2008

How do I listen for a constrained property change?

The constrained property change is fired when a bean’s value is about to change. When a VetoableChangeListener veto the value change the bean’s value will be rolled-back to the previous value. In this example we have a constrained property called interest. package org.kodejava.bean; import java.beans.VetoableChangeSupport; import java.beans.PropertyVetoException; public class VetoBean { private double interest; private […]

Wayan · 2 min read
BEANS / NOTES</>↗
Beans12 Jun 2008

How do I listen for bean’s property change event?

In this example we’ll listen to bean’s property change event. We create a small bean named MyBean, adds attributes and getter/setter. We want to know or to get notified when the bean property name is changed. First we need the add a PropertyChangeSupport field to the bean, with this object we will fire the property […]

Wayan · 2 min read
CORE API / NOTES</>↗
Core API09 Jun 2008

How do I sort strings using Collator class?

In this example we demonstrate how to use the java.text.Collator class to sort strings in language-specific order. Using the java.text.Collator class makes the string not just sorted by the ASCII code of their characters, but it will follow the language natural order of the characters. package org.kodejava.text; import java.util.List; import java.util.ArrayList; import java.util.Locale; import java.text.Collator; […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API06 Jun 2008

How do I convert ResourceBundle to Properties?

package org.kodejava.util; import java.util.*; public class ResourceBundleToProperties { public static void main(String[] args) { // Load resource bundle Messages_en_GB.properties from the classpath. ResourceBundle resource = ResourceBundle.getBundle("Messages", Locale.UK); // Call the convertResourceBundleToProperties method to convert the resource // bundle into a Properties object. Properties properties = convertResourceBundleToProperties(resource); // Print the entire con...

Wayan · 1 min read
✳

Knowledge grows when shared.

Stay curious. There is always something new to learn.

Explore notes ↗
Putu Adi Guna Permana
ABOUT THE AUTHOR

Dr (C). Ir. Putu Adi Guna Permana, S.Kom., M.Kom., IPM., ASEAN Eng.

Writer and founder of Diary Coding — sharing notes, tutorials, and experiences about programming for anyone who wants to keep learning.