아래 코드를 사용하여 XML 문자열을 비 정렬 화하여 아래 JAXB 객체에 매핑하는 방법은 무엇입니까?
JAXBContext jaxbContext = JAXBContext.newInstance(Person.class);
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
Person person = (Person) unmarshaller.unmarshal("xml string here");
@XmlRootElement(name = "Person")
public class Person {
@XmlElement(name = "First-Name")
String firstName;
@XmlElement(name = "Last-Name")
String lastName;
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
}