Package br.com.caelum.vraptor.converter

Examples of br.com.caelum.vraptor.converter.ConversionError


            DecimalFormat fmt = ((DecimalFormat) DecimalFormat.getInstance(locale));
            fmt.setParseBigDecimal(true);
           
            return (BigDecimal) fmt.parse(value);
        } catch (ParseException e) {
            throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_number"), value));
        }
    }
View Full Code Here


            final Locale locale = localization.getLocale();
            DecimalFormat fmt = ((DecimalFormat) DecimalFormat.getInstance(locale));

            return fmt.parse(value).doubleValue();
        } catch (ParseException e) {
            throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_number"), value));
        }
    }
View Full Code Here

            final Locale locale = localization.getLocale();
            DecimalFormat fmt = ((DecimalFormat) DecimalFormat.getInstance(locale));

      return fmt.parse(value).doubleValue();
    } catch (ParseException e) {
      throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_number"), value));
    }
  }
View Full Code Here

        return null;
      }
     
      return out.toLocalDate();
    } catch (Exception e) {
      throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_date"), value));
    }
  }
View Full Code Here

        return null;
      }
     
      return out.toDateTime();
    } catch (Exception e) {
      throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_datetime"), value));
    }
  }
View Full Code Here

        return null;
      }
   
      return out.toLocalDateTime();
    } catch (Exception e) {
      throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_datetime"), value));
    }
  }
View Full Code Here

      return null;
      }
     
      return out.toLocalTime();
    } catch (Exception e) {
        throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_time"), value));
    }
  }
View Full Code Here

        return null;
      }
     
      return out.toDateMidnight();
    } catch (Exception e) {
      throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_datetime"), value));
    }
  }
View Full Code Here

      contexts.put(ctx.getRoot(), ctx);
    } catch (MethodFailedException e) { // setter threw an exception

      Throwable cause = e.getCause();
      if (cause.getClass().isAnnotationPresent(ValidationException.class)) {
        throw new ConversionError(cause.getLocalizedMessage());
      } else {
        throw new InvalidParameterException("unable to parse expression '" + key + "'", e);
      }

    } catch (NoSuchPropertyException ex) {
View Full Code Here

      Date date = iso8601.toDate(value);

      return date;
    } catch (ParseException e) {
      throw new ConversionError("Error to convert Date: "  + e.getMessage());
    }
  }
View Full Code Here

TOP

Related Classes of br.com.caelum.vraptor.converter.ConversionError

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.