Package org.springframework.core.convert.support

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


  @Test
  public void testBindingTelnetIgnored() {
    ShellProperties props = new ShellProperties();
    RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell");
    binder.setConversionService(new DefaultConversionService());
    Map<String, String> map = new HashMap<String, String>();
    map.put("shell.telnet.enabled", "false");
    map.put("shell.telnet.port", "2222");
    binder.bind(new MutablePropertyValues(map));
    assertFalse(binder.getBindingResult().hasErrors());
View Full Code Here


  @Test
  public void testBindingJaas() {
    JaasAuthenticationProperties props = new JaasAuthenticationProperties();
    RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell.auth.jaas");
    binder.setConversionService(new DefaultConversionService());
    Map<String, String> map = new HashMap<String, String>();
    map.put("shell.auth.jaas.domain", "my-test-domain");
    binder.bind(new MutablePropertyValues(map));
    assertFalse(binder.getBindingResult().hasErrors());
View Full Code Here

  @Test
  public void testBindingKey() {
    KeyAuthenticationProperties props = new KeyAuthenticationProperties();
    RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell.auth.key");
    binder.setConversionService(new DefaultConversionService());
    Map<String, String> map = new HashMap<String, String>();
    map.put("shell.auth.key.path", "~/.ssh/test.pem");
    binder.bind(new MutablePropertyValues(map));
    assertFalse(binder.getBindingResult().hasErrors());
View Full Code Here

  @Test
  public void testBindingKeyIgnored() {
    KeyAuthenticationProperties props = new KeyAuthenticationProperties();
    RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell.auth.key");
    binder.setConversionService(new DefaultConversionService());
    Map<String, String> map = new HashMap<String, String>();
    binder.bind(new MutablePropertyValues(map));
    assertFalse(binder.getBindingResult().hasErrors());

    Properties p = new Properties();
View Full Code Here

  @Test
  public void testBindingSimple() {
    SimpleAuthenticationProperties props = new SimpleAuthenticationProperties();
    RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell.auth.simple");
    binder.setConversionService(new DefaultConversionService());
    Map<String, String> map = new HashMap<String, String>();
    map.put("shell.auth.simple.user.name", "username123");
    map.put("shell.auth.simple.user.password", "password123");
    binder.bind(new MutablePropertyValues(map));
    assertFalse(binder.getBindingResult().hasErrors());
View Full Code Here

  @BeforeClass
  public static void setUp() {

    MappingPdxSerializer serializer = new MappingPdxSerializer(new GemfireMappingContext(),
        new DefaultConversionService());

    CacheFactory factory = new CacheFactory();
    factory.setPdxSerializer(serializer);
    factory.setPdxPersistent(true);
    cache = factory.create();
View Full Code Here

  /**
   * Creates a new {@link MappingPdxSerializer} using the default
   * {@link GemfireMappingContext} and {@link DefaultConversionService}.
   */
  public MappingPdxSerializer() {
    this(new GemfireMappingContext(), new DefaultConversionService());
  }
View Full Code Here

   *
   * @param mappingContext must not be {@literal null}.
   */
  public MappingCassandraConverter(CassandraMappingContext mappingContext) {

    super(new DefaultConversionService());

    Assert.notNull(mappingContext);

    this.mappingContext = mappingContext;
    this.spELContext = new SpELContext(RowReaderPropertyAccessor.INSTANCE);
View Full Code Here

    this.conversionService = createDefaultConversionService();
  }

  protected ConfigurableConversionService createDefaultConversionService() {

    ConfigurableConversionService conversionService = new DefaultConversionService();

    for (Converter<?, ?> converter : DEFAULT_CONVERTERS) {
      conversionService.addConverter(converter);
    }

    return conversionService;
  }
View Full Code Here

      IBean bean = getBean(autowiredAnnotationBeanPostProcessorName);
      BeanDefinition beanDef = BeansModelUtils.getMergedBeanDefinition(bean, context);
      if (beanDef.getPropertyValues().size() > 0) {
        BeanWrapperImpl wrapper = new BeanWrapperImpl(true);
        wrapper.setConversionService(new DefaultConversionService());
        wrapper.setWrappedInstance(provider);
        for (PropertyValue pv : beanDef.getPropertyValues().getPropertyValueList()) {
          if (wrapper.isWritableProperty(pv.getName())) {
            // TODO other values types required as well?
            if (pv.getValue() instanceof TypedStringValue) {
              wrapper.setPropertyValue(pv.getName(), (((TypedStringValue) pv.getValue())).getValue());
            }
          }
        }
      }
      provider.setProblemReporter(problemReporter);
      providers.add(provider);
    }

    String[] commonAnnotationBeanPostProcessorNames = getBeansForType(CommonAnnotationBeanPostProcessor.class.getName());
    for (String commonAnnotationBeanPostProcessorName : commonAnnotationBeanPostProcessorNames) {
      CommonAnnnotationInjectionMetadataProvider provider = new CommonAnnnotationInjectionMetadataProvider();

      IBean bean = getBean(commonAnnotationBeanPostProcessorName);
      BeanDefinition beanDef = BeansModelUtils.getMergedBeanDefinition(bean, context);
      if (beanDef.getPropertyValues().size() > 0) {
        BeanWrapperImpl wrapper = new BeanWrapperImpl(true);
        wrapper.setConversionService(new DefaultConversionService());
        wrapper.setWrappedInstance(provider);
        for (PropertyValue pv : beanDef.getPropertyValues().getPropertyValueList()) {
          if (wrapper.isWritableProperty(pv.getName())) {
            // TODO other values types required as well?
            if (pv.getValue() instanceof TypedStringValue) {
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.