OXM(Object XML Mapping) : XML 데이터의 객체 맵핑을 다루는 개념
OXM의 개념을 알고 있으면 MarshallingHttpMessageConverter를 사용한 XML 객체 맵핑도 가능
마샬링(mashalling) : 특정 데이터를 XML 형태로 만드는 것
언마샬링(unmashalling) : XML 데이터를 특정 데이터로 만드는 것
JAXB(Java Architecture for XML Binding) : OXM을 쉽게 도와주는 도구와 같음
마샬링, 언마샬링의 과정을 JAXB Annotation을 사용하여 직관적이고 쉽게 맵핑할 수 있도록 도와줌
O/X (object / XML) Mapper Annotation
@XmlRootElement : Class에 사용하는 annotation으로 해당 클래스가 XML 특정 노드의 루트라는 것을 뜻합니다. name을 사용하여 root를 명시할 수 있습니다.
@XmlAccessorType : XML 데이터를 어떤 방법으로 맵핑할지를 선언해줄 수 있는 어노테이션.
@XmlAccessorType(XmlAccessType.NONE) : 객체의 속성, 함수들을 수동으로 지정하는 경우, 어노테이션 한 것만 추출한다.
@XmlAccessorType(XmlAccessType.FIELD) : 객체의 속성들을 출력 노드로 사용, 필드는 모두 추출한다.
@XmlAccessorType(XmlAccessType.PROPERTY) : 프로퍼티는 모두 추출한다.
@XmlAccessorType(XmlAccessType.PUBLIC_NUMBER) : 퍼블릭만 처리한다.??
@XmlElementWrapper(name = "animals") : 해당 변수가 특정 노드들을 감싸고 있는 Wrapper란 것을 명시함.
@XmlElement : 변수에 사용하는 annotaion으로 해당 변수가 XML의 노드임을 뜻 합니다. XmlRootElement로 선언된 영역에서 해당 변수 이름과 맵핑하려는 XML 데이터 노드 이름이 같다면 굳이 명시해주지 않아도 됩니다.
@XmlElement(type=Object.class) : interface 구현 객체를 지원 할 수 있게됨 ????
@XmlID : 지정된 속성이 있는경우 1개의 인스턴스 사용으로 @XmlIDREF에 참조 시킴
@XmlElementRef : annotation delegates the type of object instantiated to the name/uri of the element. This enables the mapping to the concept of substitution groups for representing inheritance.
@XmlAnyElement : allows you to map a wild card section of your XML document.
@XmlAnyElement(lax=true) : elements associated with domain objects will be converted to the corresponding domain object.