com.fasterxml.jackson.databind.annotation.JsonNaming源码实例Demo

类com.fasterxml.jackson.databind.annotation.JsonNaming源码实例Demo

下面列出了com.fasterxml.jackson.databind.annotation.JsonNaming 类实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: jsonschema-generator   文件: JacksonModule.java
/**
 * Look-up the given type's {@link JsonNaming} annotation and instantiate the declared {@link PropertyNamingStrategy}.
 *
 * @param declaringType type declaring fields for which the applicable naming strategy should be looked-up
 * @return annotated naming strategy instance (or {@code null})
 */
private PropertyNamingStrategy getAnnotatedNamingStrategy(Class<?> declaringType) {
    return Optional.ofNullable(declaringType.getAnnotation(JsonNaming.class))
            .map(JsonNaming::value)
            .map(strategyType -> {
                try {
                    return strategyType.newInstance();
                } catch (InstantiationException | IllegalAccessException ex) {
                    return null;
                }
            })
            .orElse(null);
}
 
源代码评论
动弹
沙发等你来抢
 类方法
 同包方法