Package org.springframework.hateoas

Examples of org.springframework.hateoas.RelProvider


  }

  @Bean
  public ObjectMapper objectMapper() {

    RelProvider relProvider = new EvoInflectorRelProvider();
    ObjectMapper mapper = new ObjectMapper();

    mapper.registerModule(new Jackson2HalModule());
    mapper.registerModule(persistentEntityModule());
    mapper.setHandlerInstantiator(new Jackson2HalModule.HalHandlerInstantiator(relProvider, null));
View Full Code Here


  public void foo() {

    List<RelProvider> providers = Arrays.asList(new AnnotationRelProvider(), new DefaultRelProvider());
    PluginRegistry<RelProvider, Class<?>> registry = OrderAwarePluginRegistry.create(providers);

    RelProvider delegatingProvider = new DelegatingRelProvider(registry);

    assertThat(delegatingProvider.supports(Sample.class), is(true));
    assertThat(delegatingProvider.getItemResourceRelFor(Sample.class), is("foo"));
    assertThat(delegatingProvider.getCollectionResourceRelFor(Sample.class), is("bar"));

    assertThat(delegatingProvider.supports(String.class), is(true));
    assertThat(delegatingProvider.getItemResourceRelFor(String.class), is("string"));
    assertThat(delegatingProvider.getCollectionResourceRelFor(String.class), is("stringList"));
  }
View Full Code Here

          }
        }
      }

      CurieProvider curieProvider = getCurieProvider(beanFactory);
      RelProvider relProvider = beanFactory.getBean(DELEGATING_REL_PROVIDER_BEAN_NAME, RelProvider.class);
      ObjectMapper halObjectMapper = beanFactory.getBean(HAL_OBJECT_MAPPER_BEAN_NAME, ObjectMapper.class);

      halObjectMapper.registerModule(new Jackson2HalModule());
      halObjectMapper.setHandlerInstantiator(new Jackson2HalModule.HalHandlerInstantiator(relProvider, curieProvider));
View Full Code Here

TOP

Related Classes of org.springframework.hateoas.RelProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.