Examples of DefaultConversionService


Examples of org.springframework.core.convert.support.DefaultConversionService

   * Create a StandardTypeConverter for the default ConversionService.
   */
  public StandardTypeConverter() {
    synchronized (this) {
      if (defaultConversionService == null) {
        defaultConversionService = new DefaultConversionService();
      }
    }
    this.conversionService = defaultConversionService;
  }
View Full Code Here

Examples of org.springframework.core.convert.support.DefaultConversionService

  private MethodParameter paramNotAnnotated;


  @Before
  public void setup() throws Exception {
    this.resolver = new DestinationVariableMethodArgumentResolver(new DefaultConversionService());

    Method method = getClass().getDeclaredMethod("handleMessage", String.class, String.class, String.class);
    this.paramAnnotated = new MethodParameter(method, 0);
    this.paramAnnotatedValue = new MethodParameter(method, 1);
    this.paramNotAnnotated = new MethodParameter(method, 2);
View Full Code Here

Examples of org.springframework.core.convert.support.DefaultConversionService

  @Before
  public void setup() throws Exception {
    @SuppressWarnings("resource")
    GenericApplicationContext cxt = new GenericApplicationContext();
    cxt.refresh();
    this.resolver = new HeaderMethodArgumentResolver(new DefaultConversionService(), cxt.getBeanFactory());

    Method method = getClass().getDeclaredMethod("handleMessage",
        String.class, String.class, String.class, String.class, String.class);
    this.paramRequired = new MethodParameter(method, 0);
    this.paramNamedDefaultValueStringHeader = new MethodParameter(method, 1);
View Full Code Here

Examples of org.springframework.core.convert.support.DefaultConversionService

  /**
   * Creates a new {@link AbstractCassandraConverter} using the given {@link ConversionService}.
   */
  public AbstractCassandraConverter(ConversionService conversionService) {
    this.conversionService = conversionService == null ? new DefaultConversionService() : conversionService;
  }
View Full Code Here

Examples of org.springframework.core.convert.support.DefaultConversionService

  public MappingElasticsearchConverter(
      MappingContext<? extends ElasticsearchPersistentEntity<?>, ElasticsearchPersistentProperty> mappingContext) {
    Assert.notNull(mappingContext);
    this.mappingContext = mappingContext;
    this.conversionService = new DefaultConversionService();
  }
View Full Code Here

Examples of org.springframework.core.convert.support.DefaultConversionService

   * @param mappingContext must not be {@literal null}.
   */
  public MappingMongoConverter(DbRefResolver dbRefResolver,
      MappingContext<? extends MongoPersistentEntity<?>, MongoPersistentProperty> mappingContext) {

    super(new DefaultConversionService());

    Assert.notNull(dbRefResolver, "DbRefResolver must not be null!");
    Assert.notNull(mappingContext, "MappingContext must not be null!");

    this.dbRefResolver = dbRefResolver;
View Full Code Here

Examples of org.springframework.core.convert.support.DefaultConversionService

  }

  @Test
  public void populatesConversionServiceCorrectly() {

    GenericConversionService conversionService = new DefaultConversionService();

    CustomConversions conversions = new CustomConversions(Arrays.asList(StringToFormatConverter.INSTANCE));
    conversions.registerConvertersIn(conversionService);

    assertThat(conversionService.canConvert(String.class, Format.class), is(true));
  }
View Full Code Here

Examples of org.springframework.core.convert.support.DefaultConversionService

   */
  @Test
  public void customConverterOverridesDefault() {

    CustomConversions conversions = new CustomConversions(Arrays.asList(CustomDateTimeConverter.INSTANCE));
    GenericConversionService conversionService = new DefaultConversionService();
    conversions.registerConvertersIn(conversionService);

    assertThat(conversionService.convert(new DateTime(), Date.class), is(new Date(0)));
  }
View Full Code Here

Examples of org.springframework.core.convert.support.DefaultConversionService

    }
  }

  private ConversionService getDefaultConversionService() {
    if (this.defaultConversionService == null) {
      DefaultConversionService conversionService = new DefaultConversionService();
      for (Converter<?, ?> converter : ((ListableBeanFactory) this.beanFactory)
          .getBeansOfType(Converter.class, false, false).values()) {
        conversionService.addConverter(converter);
      }
      this.defaultConversionService = conversionService;
    }
    return this.defaultConversionService;
  }
View Full Code Here

Examples of org.springframework.core.convert.support.DefaultConversionService

  }

  @Test
  public void testBindNestedListCommaDelimitedOnly() throws Exception {
    TargetWithNestedList target = new TargetWithNestedList();
    this.conversionService = new DefaultConversionService();
    bind(target, "nested: bar,foo");
    assertEquals("[bar, foo]", target.getNested().toString());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.