Package org.springframework.data.mongodb.core.convert

Examples of org.springframework.data.mongodb.core.convert.CustomConversions$CacheValue


  public CacheValue detachFromCache() {
    if (_baseCacheValue instanceof ByteArrayCacheValue) {
      // already detached
      return null;
    } else if (_baseCacheValue instanceof UnsafeCacheValue) {
      final CacheValue result = _baseCacheValue;
      if (get() == 0) {
        // No one is using this so don't copy
        // NULL out reference so just in case there can't be a seg fault.
        _baseCacheValue = null;
      } else {
View Full Code Here


    @Bean
    public CustomConversions customConversions() {
        List<Converter<?, ?>> converterList = new ArrayList<>();
        OAuth2AuthenticationReadConverter converter = new OAuth2AuthenticationReadConverter();
        converterList.add(converter);
        return new CustomConversions(converterList);
    }<% } %>
View Full Code Here

    @Bean
    public CustomConversions customConversions() {
        List<Converter<?, ?>> converterList = new ArrayList<>();
        OAuth2AuthenticationReadConverter converter = new OAuth2AuthenticationReadConverter();
        converterList.add(converter);
        return new CustomConversions(converterList);
    }<% } %>
View Full Code Here

        converters.add(new UserIdReadConverter());
        converters.add(new UserIdWriteConverter());
        converters.add(new EmailAddressReadConverter());
        converters.add(new EmailAddressWriteConverter());

        mappingMongoConverter.setCustomConversions(new CustomConversions(converters));
        return mappingMongoConverter;
    }
View Full Code Here

  public CustomConversions customConversions() {

    List<Converter<?, ?>> converters = new ArrayList<Converter<?, ?>>();
    converters.add(new org.springframework.data.mongodb.core.PersonReadConverter());
    converters.add(new org.springframework.data.mongodb.core.PersonWriteConverter());
    return new CustomConversions(converters);
  }
View Full Code Here

   *
   * @return must not be {@literal null}.
   */
  @Bean
  public CustomConversions customConversions() {
    return new CustomConversions(Collections.emptyList());
  }
View Full Code Here

  @Autowired
  @SuppressWarnings("unchecked")
  public void setMongo(Mongo mongo) throws Exception {

    CustomConversions conversions = new CustomConversions(Arrays.asList(DateToDateTimeConverter.INSTANCE,
        DateTimeToDateConverter.INSTANCE));

    MongoMappingContext mappingContext = new MongoMappingContext();
    mappingContext.setInitialEntitySet(new HashSet<Class<?>>(Arrays.asList(PersonWith_idPropertyOfTypeObjectId.class,
        PersonWith_idPropertyOfTypeString.class, PersonWithIdPropertyOfTypeObjectId.class,
        PersonWithIdPropertyOfTypeString.class, PersonWithIdPropertyOfTypeInteger.class,
        PersonWithIdPropertyOfTypeBigInteger.class, PersonWithIdPropertyOfPrimitiveInt.class,
        PersonWithIdPropertyOfTypeLong.class, PersonWithIdPropertyOfPrimitiveLong.class)));
    mappingContext.setSimpleTypeHolder(conversions.getSimpleTypeHolder());
    mappingContext.initialize();

    DbRefResolver dbRefResolver = new DefaultDbRefResolver(factory);
    MappingMongoConverter mappingConverter = new MappingMongoConverter(dbRefResolver, mappingContext);
    mappingConverter.setCustomConversions(conversions);
View Full Code Here

   */
  @Test
  public void scansForConverterAndSetsUpCustomConversionsAccordingly() {

    loadValidConfiguration();
    CustomConversions conversions = factory.getBean(CustomConversions.class);
    assertThat(conversions.hasCustomWriteTarget(Person.class), is(true));
    assertThat(conversions.hasCustomWriteTarget(Account.class), is(true));
  }
View Full Code Here

   * @see DATAMONGO-912
   */
  @Test
  public void shouldUseCustomConversionIfPresentAndConversionIsRequiredInFirstStage() {

    CustomConversions customConversions = customAgeConversions();
    converter.setCustomConversions(customConversions);
    customConversions.registerConvertersIn((GenericConversionService) converter.getConversionService());

    AggregationOperationContext context = getContext(FooPerson.class);

    MatchOperation matchStage = match(Criteria.where("age").is(new Age(10)));
    ProjectionOperation projectStage = project("age", "name");
View Full Code Here

   * @see DATAMONGO-912
   */
  @Test
  public void shouldUseCustomConversionIfPresentAndConversionIsRequiredInLaterStage() {

    CustomConversions customConversions = customAgeConversions();
    converter.setCustomConversions(customConversions);
    customConversions.registerConvertersIn((GenericConversionService) converter.getConversionService());

    AggregationOperationContext context = getContext(FooPerson.class);

    MatchOperation matchStage = match(Criteria.where("age").is(new Age(10)));
    ProjectionOperation projectStage = project("age", "name");
View Full Code Here

TOP

Related Classes of org.springframework.data.mongodb.core.convert.CustomConversions$CacheValue

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.