List of usage examples for com.fasterxml.jackson.databind.introspect BeanPropertyDefinition hasGetter
public abstract boolean hasGetter();
From source file:springfox.documentation.schema.Annotations.java
@SuppressWarnings("PMD") private static <A extends Annotation> Optional<A> tryGetGetterAnnotation( BeanPropertyDefinition beanPropertyDefinition, Class<A> annotationClass) { if (beanPropertyDefinition.hasGetter()) { return Optional.fromNullable(beanPropertyDefinition.getGetter().getAnnotation(annotationClass)); }// w w w .j av a 2 s. c om return Optional.absent(); }
From source file:com.github.jonpeterson.jackson.module.versioning.VersionedModelUtils.java
public static BeanPropertyDefinition getSerializeToVersionProperty(BeanDescription beanDescription) throws RuntimeException { BeanPropertyDefinition serializeToVersionProperty = null; for (BeanPropertyDefinition definition : beanDescription.findProperties()) { // merge field and accessor annotations if (definition instanceof POJOPropertyBuilder) ((POJOPropertyBuilder) definition).mergeAnnotations(true); AnnotatedMember accessor = definition.getAccessor(); if (accessor != null && accessor.hasAnnotation(JsonSerializeToVersion.class)) { if (serializeToVersionProperty != null) throw new RuntimeException("@" + JsonSerializeToVersion.class.getSimpleName() + " must be present on at most one field or method"); if (accessor.getRawType() != String.class || (definition.getField() == null && !definition.hasGetter())) throw new RuntimeException("@" + JsonSerializeToVersion.class.getSimpleName() + " must be on a field or a getter method that returns a String"); serializeToVersionProperty = definition; }/*www . jav a2 s . c o m*/ } return serializeToVersionProperty; }