Package org.springframework.core.convert.support

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


   * @param beanFactory a bean factory to use for resolving {@code ${...}} placeholder
   * and {@code #{...}} SpEL expressions in default values, or {@code null} if default
   * values are not expected to contain expressions
   */
  protected AbstractNamedValueMethodArgumentResolver(ConversionService cs, ConfigurableBeanFactory beanFactory) {
    this.conversionService = (cs != null ? cs : new DefaultConversionService());
    this.configurableBeanFactory = beanFactory;
    this.expressionContext = (beanFactory != null ? new BeanExpressionContext(beanFactory, null) : null);
  }
View Full Code Here


    return this.beanFactory;
  }

  public ConversionService getConversionService() {
    if (this.conversionService == null) {
      this.conversionService = new DefaultConversionService();
    }
    return this.conversionService;
  }
View Full Code Here

  /**
   * Create a new instance with a default {@link ConversionService}.
   */
  public GenericMessageConverter() {
    this.conversionService = new DefaultConversionService();
  }
View Full Code Here

    assertEquals("Invalid charset", Charset.forName("UTF-8"), mimeType.getCharSet());
  }

  @Test
  public void testWithConversionService() {
    ConversionService conversionService = new DefaultConversionService();
    assertTrue(conversionService.canConvert(String.class, MimeType.class));
    MimeType mimeType = MimeType.valueOf("application/xml");
    assertEquals(mimeType, conversionService.convert("application/xml", MimeType.class));
  }
View Full Code Here

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

  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

  @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

  /**
   * 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

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

   * @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

TOP

Related Classes of org.springframework.core.convert.support.DefaultConversionService

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.