Example usage for org.springframework.data.rest.core.mapping MethodResourceMapping getRel

List of usage examples for org.springframework.data.rest.core.mapping MethodResourceMapping getRel

Introduction

In this page you can find the example usage for org.springframework.data.rest.core.mapping MethodResourceMapping getRel.

Prototype

LinkRelation getRel();

Source Link

Document

Returns the relation for the resource exported.

Usage

From source file:org.springframework.data.rest.webmvc.alps.RootResourceInformationToAlpsDescriptorConverter.java

private Collection<Descriptor> buildSearchResourceDescriptors(PersistentEntity<?, ?> entity) {

    ResourceMetadata metadata = associations.getMetadataFor(entity.getType());
    List<Descriptor> descriptors = new ArrayList<Descriptor>();

    for (MethodResourceMapping methodMapping : metadata.getSearchResourceMappings()) {

        List<Descriptor> parameterDescriptors = new ArrayList<Descriptor>();

        for (ParameterMetadata parameterMetadata : methodMapping.getParametersMetadata()) {

            parameterDescriptors.add(//
                    descriptor().//
                            name(parameterMetadata.getName()).//
                            doc(getDocFor(parameterMetadata.getDescription())).//
                            type(Type.SEMANTIC)//
                            .build());// ww  w . j  a  va  2 s.co  m
        }

        descriptors.add(descriptor().//
                type(Type.SAFE).//
                name(methodMapping.getRel()).//
                descriptors(parameterDescriptors).//
                build());
    }

    return descriptors;
}