private List<Descriptor> createJacksonDescriptor(String name, Class<?> type) { List<Descriptor> descriptors = new ArrayList<Descriptor>(); for (BeanPropertyDefinition definition : new JacksonMetadata(mapper, type)) { AnnotatedMethod getter = definition.getGetter(); Description description = getter.getAnnotation(Description.class); ResourceDescription fallback = SimpleResourceDescription.defaultFor(String.format("%s.%s", name, definition.getName())); ResourceDescription resourceDescription = description == null ? null : new AnnotationBasedResourceDescription(description, fallback); descriptors.add( // descriptor() . // name(definition.getName()) . // type(Type.SEMANTIC) . // doc(getDocFor(resourceDescription)) . // build()); } return descriptors; }
@Override public <A extends Annotation> A getAnnotation(Class<A> acls) { return _annotated.getAnnotation(acls); }