@ SuppressWarnings ( "unchecked" ) public static < T > T toObjectWithXStream ( XStream xstream , final String xmlString , final Map < String , Class < ? > > aliases ) { if ( xstream == null ) { xstream = new XStream ( ) ; } if ( aliases != null ) { for ( final Map . Entry < String , Class < ? > > alias : aliases . entrySet ( ) ) { xstream . alias ( alias . getKey ( ) , alias . getValue ( ) ) ; } } return ( T ) xstream . fromXML ( xmlString ) ; }
Creates from the given xml string an java object . The given map hold the aliases . For more information with aliasing see documation of xstream .