Hi,this is regarding JAXB API doing Unmarshalling for the Person.java class
.but what i need is the Unmarshalling method for the generalized class.
here folder is the generated folder containing Person and ObjectFactory class after compiling with the xjc compiler.
i have tried the same but with no answer

This answer is specific to Person.java class what i want is answer with no Person word i.e generalize method.


import java.io.*;
import java.io.File;
import java.util.Date;
import java.io.*;
import folder.*;

import folder.Person;
import folder.ObjectFactory;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.Marshaller;

public class Unmarshaltrr
{

public Unmarshaltrr()
{

}

public void UnMarshal_fn(ByteArrayOutputStream buf_in)

{ try

{

JAXBContext jc = JAXBContext.newInstance ("folder");

Unmarshaller u = jc.createUnmarshaller ();
ObjectInputStream in=new ObjectInputStream(new ByteArrayInputStream(buf_in.toByteArray()));


JAXBElement element = (JAXBElement) u.unmarshal (in);


Person item=(Person)element.getValue();//Person not Required
System.out.println (item.getName()); //these are the values in Person
System.out.println (item.getDateOfBirth());
System.out.println (item.getType());

}
catch (JAXBException e)
{

e.printStackTrace ();


}


catch(IOException e)
{
e.getMessage();
}


} // UnMarshal_fn

}

I tried to do with Reflection Property.Passed the Person object from the Main method
unmarshal_fn( ,Person a);\\function calling

Unmarshalling method:-
unmarshal_fn( , Object obj)
{
Class c=obj.getClass();
.
.
.

c item =(c)element.getValue();
System.out.println(item.getName());// this is a wrong statement-this is the problem how should i make the object of the Person class here????