<dependency> <groupId>com.tongji409</groupId> <artifactId>objectos-io</artifactId> <version>0.9.11</version> </dependency> groovy implementation 'com.tongji409:objectos-io:0.9.11' <book> <year>2020</year> </book> import io.objectos.core.annotation.Property; import io.objectos.core.annotation.Value; public class Book { @Property("book.title") private String title; @Property("book.author") private String author; @Value("#{book.year ?: 'Unknown'}") private String year; } import io.objectos.core.util.PropertyPaths; public class XmlParser { public static void main(String[] args) { OiParser parser = Oi .reader() .register(Book.class) .reader(); Book book = parser.parse(PropertyPaths.from("book"), xmlData, Book.class); } }


上一篇:
下一篇:
切换中文