Java examples for Reflection:Java Bean
xml Decode Java Bean
//package com.java2s; import java.beans.XMLDecoder; import java.io.*; public class Main { public static Object xmlDecode(byte[] bytes) { Object obj;//from w w w . j av a2 s .com InputStream is = new ByteArrayInputStream(bytes); try (XMLDecoder d = new XMLDecoder(is)) { obj = d.readObject(); } return obj; } public static <T> T xmlDecode(byte[] bytes, Class<T> clazz) { return (T) xmlDecode(bytes); } }