Example usage for org.springframework.restdocs.payload FieldDescriptor getPath

List of usage examples for org.springframework.restdocs.payload FieldDescriptor getPath

Introduction

In this page you can find the example usage for org.springframework.restdocs.payload FieldDescriptor getPath.

Prototype

public final String getPath() 

Source Link

Document

Returns the path of the field described by this descriptor.

Usage

From source file:com.ethlo.geodata.restdocs.AbstractJacksonFieldSnippet.java

private void resolveFieldDescriptors(Map<String, FieldDescriptor> fieldDescriptors, Type type,
        ObjectMapper objectMapper, JavadocReader javadocReader, ConstraintReader constraintReader)
        throws JsonMappingException {
    FieldDocumentationGenerator generator = new FieldDocumentationGenerator(objectMapper.writer(),
            objectMapper.getDeserializationConfig(), javadocReader, constraintReader);
    List<FieldDescriptor> descriptors = generator.generateDocumentation(type, objectMapper.getTypeFactory());
    for (FieldDescriptor descriptor : descriptors) {
        if (fieldDescriptors.get(descriptor.getPath()) == null) {
            fieldDescriptors.put(descriptor.getPath(), descriptor);
        }//  w w w.java2  s. co  m
    }
}