src/main/java/de/alpharogroup/xml/XmlToObjectExtensions.java
@SuppressWarnings("unchecked")
	public static <T> T toObjectWithXMLDecoder(final String xmlString)
	{

		XMLDecoder dec = null;
		T obj = null;
		try
		{
			final InputStream is = new ByteArrayInputStream(xmlString.getBytes());
			dec = new XMLDecoder(is);

			obj = (T)dec.readObject();

		}
		finally
		{
			if (dec != null)
			{
				dec.close();
			}
		}
		return obj;
	}
@SuppressWarnings("unchecked")
	public static <T> T toObjectWithXMLDecoder(final String xmlString)
	{

		XMLDecoder dec = null;
		T obj = null;
		try
		{
			final InputStream is = new ByteArrayInputStream(xmlString.getBytes());
			dec = new XMLDecoder(is);

			obj = (T)dec.readObject();

		}
		finally
		{
			if (dec != null)
			{
				dec.close();
			}
		}
		return obj;
	}
@ SuppressWarnings ( "unchecked" ) public static < T > T toObjectWithXMLDecoder ( final String xmlString ) { XMLDecoder dec = null ; T obj = null ; try { final InputStream is = new ByteArrayInputStream ( xmlString . getBytes ( ) ) ; dec = new XMLDecoder ( is ) ; obj = ( T ) dec . readObject ( ) ; } finally { if ( dec != null ) { dec . close ( ) ; } } return obj ; }
Creates from the given xml string an java object.

@param <T>
the generic type
@param xmlString
the xml string to transform to an java object.
@return the xml string
Creates from the given xml string an java object .