use of org.hibernate.validator.spi.nodenameprovider.Property in project java-chassis by ServiceComb.
the class JacksonPropertyNodeNameProvider method getJavaBeanPropertyName.
private String getJavaBeanPropertyName(JavaBeanProperty property) {
ObjectMapper objectMapper = DatabindCodec.mapper();
JavaType type = objectMapper.constructType(property.getDeclaringClass());
BeanDescription desc = objectMapper.getSerializationConfig().introspect(type);
return desc.findProperties().stream().filter(prop -> prop.getInternalName().equals(property.getName())).map(BeanPropertyDefinition::getName).findFirst().orElse(property.getName());
}
use of org.hibernate.validator.spi.nodenameprovider.Property in project incubator-servicecomb-java-chassis by apache.
the class JacksonPropertyNodeNameProvider method getJavaBeanPropertyName.
private String getJavaBeanPropertyName(JavaBeanProperty property) {
ObjectMapper objectMapper = DatabindCodec.mapper();
JavaType type = objectMapper.constructType(property.getDeclaringClass());
BeanDescription desc = objectMapper.getSerializationConfig().introspect(type);
return desc.findProperties().stream().filter(prop -> prop.getInternalName().equals(property.getName())).map(BeanPropertyDefinition::getName).findFirst().orElse(property.getName());
}
Aggregations