Convert is a framework for decoupled conversion of Java objects from one type to another.
It is very often required in a Java program to convert one object type to another, e.g. String “33” to Integer 33, or String “java.util.Map” to class java.util.Map, or String “myRequestQueue” to JMS Queue. In Java there is no standard way to perform such conversions. To convert String to Integer we need to use Integer.parseInt(), to convert String to Class we need to use Class.forName() or ClassLoader.loadClass(), to convert String to Queue we need either naming context or JMS Session and invoke respective methods of these objects.
The Convert framework provides an extensible unified approach for type conversion in Java. Conversions can be context-free (e.g. “33”→33) or context-dependent (e.g. “myRequestQueue” → JMS Queue).
The picture above shows framework participants and dependencies:
getAdapter(targetClass) is invoked. If the method returned value is not null, then it is returned from the convert() method.Adaptable. If conversion is successful, that adaptable's getAdapter(targetClass) is invoked to produce return value.The framework defines a number of out-of-the-box converters in FoundationAtomicConverterBundle class. This class defines converters for primitive types and converters
See source of FoundationAtomicConverterBundle.getConverters() method for more details.
AtomicConverterAtomicConverterBundleConverter