Package org.strecks.converter.handler

Examples of org.strecks.converter.handler.ConversionHandler


  @Test
  public void testInvalidOutwardConversion()
  {

    ConversionHandler conversionHandler = createStrictMock(ConversionHandler.class);

    IntToIntConverter converter = new IntToIntConverter();
    BindSimpleHandler handler = new BindSimpleHandler();
    TargetBean bean = new TargetBean();
    bean.setStringProperty("2");
View Full Code Here


    if (isDeferred()) return null;
   
    Assert.notNull(validationInfo);
    Assert.notNull(form);

    ConversionHandler conversionHandler = validationInfo.getConversionHandler();

    Map<OrderedProperty, MethodValidators> validators = validationInfo.getValidators();
    Set<OrderedProperty> keySet = validators.keySet();
    for (OrderedProperty property : keySet)
    {
      MethodValidators methodValidators = validators.get(property);
      if (methodValidators.getRequiresConversion())
      {
        if (convertedValues == null)
          convertedValues = new HashMap<String, Object>();
        Converter converter = methodValidators.getConverter();

        Object converted = null;

        // catch the conversion exception, and throw
        String propertyName = property.getPropertyName();

        try
        {
          converted = conversionHandler.getAndConvertInwards(form, propertyName, converter);

          if (converted != null)
          {

            // check that converted is actually of correct type
View Full Code Here

  @Test
  public void testGetConversionHandler() throws Exception
  {
    BindConvertInfo bci = createStrictMock(BindConvertInfo.class);
    ConversionHandler conversionHandler = createStrictMock(ConversionHandler.class);

    ValidationAnnotationReader reader = new ValidationAnnotationReader();

    expect(bci.getConversionHandler()).andReturn(conversionHandler);
    replay(bci);
View Full Code Here

      if (methodValidators != null)
        map.put(methodValidators.getOrderedProperty(), methodValidators);

    }

    ConversionHandler conversionHandler = getConversionHandler(info);

    ValidationInfo vi = new ValidationInfo(map, new DefaultValidationStrategy(), conversionHandler);
    return vi;
  }
View Full Code Here

  }

  ConversionHandler getConversionHandler(BindConvertInfo info)
  {
    ConversionHandler conversionHandler = null;

    if (info != null)
    {
      conversionHandler = info.getConversionHandler();
    }
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();
View Full Code Here

TOP

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

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.