Package org.strecks.converter.handler

Examples of org.strecks.converter.handler.DefaultConversionHandler


    handler = new BindSimpleHandler();
    handler.setBeanLocatingExpression("targetBean");
    handler.setBeanPropertyName("integerProperty");
    handler.setConverter(new StandardBeanUtilsConverter());
    handler.setConversionHandler(new DefaultConversionHandler());

    // needed for binding outwards
    PropertyDescriptor propertyDescriptor = PropertyUtils.getPropertyDescriptor(new BindableBean(), "intProperty");
    handler.setPropertyDescriptor(propertyDescriptor);
View Full Code Here


    handler.setTargetBeanExpression("targetBean.domainClass");
    handler.setBeanPropertyIdName("id");
    handler.setBeanLookupExpression("lookupMap");
    handler.setBeanPropertyName("domainClass");
    handler.setBeanPropertyClass(Integer.class);
    handler.setConversionHandler(new DefaultConversionHandler());

    Converter converter = new StandardBeanUtilsConverter();
    handler.setConverter(converter);
    converter.setTargetClass(Integer.class);
View Full Code Here

    simpleForm = new SimpleStrutsForm();
    bindHandler = createStrictMock(BindHandler.class);
    Map<String, BindHandler> map = new HashMap<String, BindHandler>();
    map.put("prop", bindHandler);

    BindConvertInfo bci = new BindConvertInfo(map, new HashMap<String, Converter>(), new DefaultConversionHandler());

    form = new DelegatingForm(simpleForm);
    form.setBindConvertInfo(bci);

  }
View Full Code Here

    MethodValidators methodValidators = createStrictMock(MethodValidators.class);
    Converter converter = createStrictMock(Converter.class);

    Date sqlDate = Date.valueOf("1999-12-12");
    simpleForm.setDateValue("1999-12-12");
    ValidationInfo vi = new ValidationInfo(validators, handler, new DefaultConversionHandler());

    expect(validators.keySet()).andReturn(keys);
    expect(keys.iterator()).andReturn(iterator);
    expect(iterator.hasNext()).andReturn(true);
    expect(iterator.next()).andReturn(op);
View Full Code Here

    MethodValidators methodValidators = createStrictMock(MethodValidators.class);
    Converter converter = createStrictMock(Converter.class);

    Date sqlDate = Date.valueOf("1999-12-12");
    simpleForm.setDateValue("1999-12-12");
    ValidationInfo vi = new ValidationInfo(validators, handler, new DefaultConversionHandler());

    expect(validators.keySet()).andReturn(keys);
    expect(keys.iterator()).andReturn(iterator);
    expect(iterator.hasNext()).andReturn(true);
    expect(iterator.next()).andReturn(op);
View Full Code Here

    Iterator iterator = createStrictMock(Iterator.class);
    OrderedProperty op = createStrictMock(OrderedProperty.class);
    MethodValidators methodValidators = createStrictMock(MethodValidators.class);
    Converter converter = createStrictMock(Converter.class);

    ValidationInfo vi = new ValidationInfo(validators, handler, new DefaultConversionHandler());

    expect(validators.keySet()).andReturn(keys);
    expect(keys.iterator()).andReturn(iterator);
    expect(iterator.hasNext()).andReturn(true);
    expect(iterator.next()).andReturn(op);
View Full Code Here

    Iterator iterator = createStrictMock(Iterator.class);
    OrderedProperty op = createStrictMock(OrderedProperty.class);
    MethodValidators methodValidators = createStrictMock(MethodValidators.class);
    Converter converter = createStrictMock(Converter.class);

    ValidationInfo vi = new ValidationInfo(validators, handler, new DefaultConversionHandler());

    expect(validators.keySet()).andReturn(keys);
    expect(keys.iterator()).andReturn(iterator);
    expect(iterator.hasNext()).andReturn(true);
    expect(iterator.next()).andReturn(op);
View Full Code Here

    {
      conversionHandler = info.getConversionHandler();
    }
    else
    {
      conversionHandler = new DefaultConversionHandler();
    }
    return conversionHandler;
  }
View Full Code Here

    Map<String, BindHandler> bindMap = new LinkedHashMap<String, BindHandler>();
    Map<String, Converter> converterMap = new LinkedHashMap<String, Converter>();

    Class thisClass = thisBean.getClass();
    ConversionHandler conversionHandler = new DefaultConversionHandler();

    for (Method getterMethod : thisClass.getMethods())
    {

      Annotation[] annotations = getterMethod.getAnnotations();

      for (Annotation annotation : annotations)
      {

        Class<? extends Annotation> annotationType = annotation.annotationType();
        BindFactoryClass factoryClass = annotationType.getAnnotation(BindFactoryClass.class);

        if (factoryClass != null)
        {

          checkMethodIsGetter(getterMethod, annotationType);

          String getterName = getterMethod.getName();
          String thisPropertyName = ReflectHelper.getPropertyName(getterName);

          // check for an explicitly named converter
          ConverterReader converterReader = new ConverterReader();
          Converter explicitConverter = converterReader.readConverter(getterMethod);

          // create factory
          BindHandlerFactory factory = ReflectHelper.createInstance(factoryClass.value(),
              BindHandlerFactory.class);

          // use factory to create handler and register this
          BindHandler handler = factory.createHandler(annotation, getterMethod, explicitConverter,
              conversionHandler);

          Class converterClass = null;
          if (explicitConverter != null)
          {
            converterClass = explicitConverter.getClass();
          }
          else
          {
            converterClass = handler.getConverter().getClass();
          }

          checkActualConverter(thisPropertyName, getterMethod, converterClass);

          bindMap.put(thisPropertyName, handler);
          converterMap.put(thisPropertyName, handler.getConverter());

        }

      }

    }

    BindConvertInfo bci = new BindConvertInfo(bindMap, converterMap, new DefaultConversionHandler());
    return bci;

  }
View Full Code Here

TOP

Related Classes of org.strecks.converter.handler.DefaultConversionHandler

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.