Example usage for org.springframework.data.rest.webmvc.mapping LinkCollector LinkCollector

List of usage examples for org.springframework.data.rest.webmvc.mapping LinkCollector LinkCollector

Introduction

In this page you can find the example usage for org.springframework.data.rest.webmvc.mapping LinkCollector LinkCollector.

Prototype

public LinkCollector(PersistentEntities entities, SelfLinkProvider linkProvider,
        Associations associationLinks) 

Source Link

Document

Creates a new PersistentEntities , SelfLinkProvider and Associations .

Usage

From source file:org.springframework.data.rest.tests.RepositoryTestsConfig.java

@Bean
public Module persistentEntityModule() {

    RepositoryResourceMappings mappings = new RepositoryResourceMappings(repositories(), persistentEntities(),
            config().getRepositoryDetectionStrategy());
    EntityLinks entityLinks = new RepositoryEntityLinks(repositories(), mappings, config(),
            mock(PagingAndSortingTemplateVariables.class), OrderAwarePluginRegistry
                    .<Class<?>, BackendIdConverter>create(Arrays.asList(DefaultIdConverter.INSTANCE)));
    SelfLinkProvider selfLinkProvider = new DefaultSelfLinkProvider(persistentEntities(), entityLinks,
            Collections.<EntityLookup<?>>emptyList());

    DefaultRepositoryInvokerFactory invokerFactory = new DefaultRepositoryInvokerFactory(repositories());
    UriToEntityConverter uriToEntityConverter = new UriToEntityConverter(persistentEntities(), invokerFactory,
            repositories());/*from ww w .  j a  v a2 s.  c om*/

    Associations associations = new Associations(mappings, config());
    LinkCollector collector = new LinkCollector(persistentEntities(), selfLinkProvider, associations);

    NestedEntitySerializer nestedEntitySerializer = new NestedEntitySerializer(persistentEntities(),
            new EmbeddedResourcesAssembler(persistentEntities(), associations, mock(ExcerptProjector.class)),
            new ResourceProcessorInvoker(Collections.<ResourceProcessor<?>>emptyList()));

    return new PersistentEntityJackson2Module(associations, persistentEntities(), uriToEntityConverter,
            collector, invokerFactory, nestedEntitySerializer, mock(LookupObjectSerializer.class));
}

From source file:org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration.java

@Bean
protected LinkCollector linkCollector() {
    return new LinkCollector(persistentEntities(), selfLinkProvider(), associationLinks());
}