在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:FasterXML/jackson-modules-java8开源软件地址:https://github.com/FasterXML/jackson-modules-java8开源编程语言:Java 99.2%开源软件介绍:OverviewThis is a multi-module umbrella project for Jackson modules needed to support Java 8 features, especially with Jackson 2.x that only requires Java 7 for running (and until 2.7 only Java 6). Jackson 2.xWhen used with Jackson 2.x, Java 8 support is provided via 3 separate modules:
all of which are built from this repository, and accessed and used as separate Jackson modules (with separate Maven artifacts). Jackson 3.0Jackson 3.0 changes things as it requires Java 8 to work and can thereby directly supported features. Because of this So you will only need to separately add "Java 8 Date/time" module (see above for description) LicenseAll modules are licensed under Apache License 2.0. StatusUsageMaven dependenciesTo include modules, you use some or all of: <!-- Parameter names -->
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-parameter-names</artifactId>
</dependency>
<!-- Java 8 Date/time -->
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<!-- Java 8 Datatypes -->
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jdk8</artifactId>
</dependency> and either include versions directly, OR, preferably, import Jackson BOM that will specify consistent version set. Note that the parent project -- Registering modulesThe most common mechanism (and one recommended by Jackson team) is to explicitly register modules you want. This is done by code like: // Up to Jackson 2.9: (but not with 3.0)
ObjectMapper mapper = new ObjectMapper()
.registerModule(new ParameterNamesModule())
.registerModule(new Jdk8Module())
.registerModule(new JavaTimeModule()); // new module, NOT JSR310Module
// with 3.0 (or with 2.10 as alternative)
ObjectMapper mapper = JsonMapper.builder() // or different mapper for other format
.addModule(new ParameterNamesModule())
.addModule(new Jdk8Module())
.addModule(new JavaTimeModule())
// and possibly other configuration, modules, then:
.build(); Alternatively, you can also auto-discover these modules with: ObjectMapper mapper = new ObjectMapper();
mapper.findAndRegisterModules(); Regardless of registration mechanism, after registration all functionality is available for all normal Jackson operations. Notes on RegistrationBut do note that you should only either explicit OR automatic registration: DO NOT combine explicit and auto-registration. If you use both, only one of registrations will have effect. And selection of which one varies by module and settings:
Also note that before Jackson 2.10, auto-registration would only register older If you want "the other" version of the module but also use auto-registration, make sure to
register "other" module explicitly AFTER calling DevelopmentMaintainersFollowing developers have committer access to this project.
MoreSee Wiki for more information (javadocs). |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论