Package org.apache.wicket.util.convert.converter

Examples of org.apache.wicket.util.convert.converter.BigDecimalConverter


   * @throws Exception
   */
  @Test
  public void thousandSeperator() throws Exception
  {
    BigDecimalConverter bdc = new BigDecimalConverter();
    assertEquals(new BigDecimal(3000), bdc.convertToObject("3 000", Locale.FRENCH));

    DoubleConverter dc = new DoubleConverter();
    assertEquals(3000, dc.convertToObject("3 000", Locale.FRENCH), 0.001);
  }
View Full Code Here


   * .html#BigDecimal%28double%29
   */
  @Test
  public void bigDecimalsDoubles()
  {
    BigDecimal bd = new BigDecimalConverter().convertToObject("0.1", Locale.US);
    assertTrue(bd.doubleValue() == 0.1d);

    bd = new BigDecimalConverter().convertToObject("0,1", Locale.GERMAN);
    assertTrue(bd.doubleValue() == 0.1d);
  }
View Full Code Here

    set(Integer.class, IntegerConverter.INSTANCE);
    set(Long.TYPE, LongConverter.INSTANCE);
    set(Long.class, LongConverter.INSTANCE);
    set(Short.TYPE, ShortConverter.INSTANCE);
    set(Short.class, ShortConverter.INSTANCE);
    set(BigDecimal.class, new BigDecimalConverter());
    set(BigInteger.class, new BigIntegerConverter());
    set(Date.class, new DateConverter());
    set(java.sql.Date.class, new SqlDateConverter());
    set(java.sql.Time.class, new SqlTimeConverter());
    set(java.sql.Timestamp.class, new SqlTimestampConverter());
View Full Code Here

    set(Integer.class, IntegerConverter.INSTANCE);
    set(Long.TYPE, LongConverter.INSTANCE);
    set(Long.class, LongConverter.INSTANCE);
    set(Short.TYPE, ShortConverter.INSTANCE);
    set(Short.class, ShortConverter.INSTANCE);
    set(BigDecimal.class, new BigDecimalConverter());
    set(BigInteger.class, new BigIntegerConverter());
    set(Date.class, new DateConverter());
    set(java.sql.Date.class, new SqlDateConverter());
    set(java.sql.Time.class, new SqlTimeConverter());
    set(java.sql.Timestamp.class, new SqlTimestampConverter());
View Full Code Here

    set(Short.class, ShortConverter.INSTANCE);
    set(Date.class, new DateConverter());
    set(java.sql.Date.class, new SqlDateConverter());
    set(java.sql.Time.class, new SqlTimeConverter());
    set(java.sql.Timestamp.class, new SqlTimestampConverter());
    set(BigDecimal.class, new BigDecimalConverter());
  }
View Full Code Here

  /**
   * @throws Exception
   */
  public void testThousandSeperator() throws Exception
  {
    BigDecimalConverter bdc = new BigDecimalConverter();
    assertEquals(new BigDecimal(3000), bdc.convertToObject("3 000", Locale.FRENCH));

    DoubleConverter dc = new DoubleConverter();
    assertEquals((double) 3000, dc.convertToObject("3 000", Locale.FRENCH));

  }
View Full Code Here

   * See WICKET-2878 and
   * http://java.sun.com/j2se/1.4.2/docs/api/java/math/BigDecimal.html#BigDecimal%28double%29
   */
  public void testBigDecimalsDoubles()
  {
    BigDecimal bd = new BigDecimalConverter().convertToObject("0.1", Locale.US);
    assertTrue(bd.doubleValue() == 0.1d);

    bd = new BigDecimalConverter().convertToObject("0,1", Locale.GERMAN);
    assertTrue(bd.doubleValue() == 0.1d);
  }
View Full Code Here

  /**
   * @throws Exception
   */
  public void testThousandSeperator() throws Exception
  {
    BigDecimalConverter bdc = new BigDecimalConverter();
    assertEquals(new BigDecimal(3000), bdc.convertToObject("3 000", Locale.FRENCH));

    DoubleConverter dc = new DoubleConverter();
    assertEquals((double)3000, dc.convertToObject("3 000", Locale.FRENCH));

  }
View Full Code Here

   * See WICKET-2878 and
   * http://java.sun.com/j2se/1.4.2/docs/api/java/math/BigDecimal.html#BigDecimal%28double%29
   */
  public void testBigDecimalsDoubles()
  {
    BigDecimal bd = new BigDecimalConverter().convertToObject("0.1", Locale.US);
    assertTrue(bd.doubleValue() == 0.1d);

    bd = new BigDecimalConverter().convertToObject("0,1", Locale.GERMAN);
    assertTrue(bd.doubleValue() == 0.1d);
  }
View Full Code Here

    set(Date.class, new DateConverter());
    set(Calendar.class, new CalendarConverter());
    set(java.sql.Date.class, new SqlDateConverter());
    set(java.sql.Time.class, new SqlTimeConverter());
    set(java.sql.Timestamp.class, new SqlTimestampConverter());
    set(BigDecimal.class, new BigDecimalConverter());
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.util.convert.converter.BigDecimalConverter

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.