添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
11
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

この時代にJackson formatter XMLでJavaBeanとXMLを変換してみた

Last updated at Posted at 2019-04-17

お察しください

pomに下記を追加

<dependency> <groupId> com.fasterxml.jackson.dataformat </groupId> <artifactId> jackson-dataformat-xml </artifactId> <version> 2.9.8 </version> </dependency> 詳細な使い方 @Builder @JacksonXmlRootElement ( localName = "top_element" ) public class TestBean implements Serializable { // isAttribute = trueを付与すると属性になる @JacksonXmlProperty ( localName = "id" , isAttribute = true ) private String topElement ; @JacksonXmlProperty ( localName = "test_field" ) private String testField ; // ネストしたBeanも書ける @JacksonXmlProperty ( localName = "test_inner_bean" ) private TestInnerBean testInnerBean ; // Beanのリストをフィールドに持てる @JacksonXmlElementWrapper ( localName = "dtls" ) @JacksonXmlProperty ( localName = "dtl" ) private List < DtlsInnerDto > dtlsInnerDto ; public class TestInnerBean implements Serializable { @JacksonXmlProperty ( localName = "inner_field_one" ) private String innerFieldOne ; @JacksonXmlProperty ( localName = "inner_field_two" ) private String innerFieldTwo ; @Builder public class DtlsInnerDto implements Serializeble { @JacksonXmlProperty ( localName = "dtl_item" ) private String dtlItem ;
11
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?