Examples of convert()


Examples of javax.measure.converter.UnitConverter.convert()

  public static double fromMeterToCrs(double value,
      CoordinateReferenceSystem crs) {
    Unit<?> unit = getUnit(crs);
    UnitConverter converter = SI.METER.getConverterTo(unit);
    return converter.convert(value);
  }

  public static double fromCrsToMeter(double value,
      CoordinateReferenceSystem crs) {
    Unit<?> unit = getUnit(crs);
View Full Code Here

Examples of javax.units.Converter.convert()

                //GR: I don't know if the featuresults should be added here for later
                //encoding if it was a lock request. may be after ensuring the lock
                //succeed?
                FeatureCollection features = FeatureCollections.newCollection();
                if (nearestFeature != null) features.add(superFeature(nearestFeature, unitConvert.convert(nearestDistance), nearestBearing));
               
                // we may need to shave off geometries we did load only to make bounds
                // computation happy
                if(extraGeometries.size() > 0) {
                    List residualProperties = new ArrayList(properties);
View Full Code Here

Examples of jodd.datetime.format.Iso8601JdtFormatter.convert()

  @Test
  public void testExternalConversion() {
    JdtFormatter fmt = new Iso8601JdtFormatter();
    JDateTime jdt = new JDateTime();
    String s1 = fmt.convert(jdt, "YYYY-MM.DD");
    assertEquals(s1, jdt.toString("YYYY-MM.DD"));
  }


  @Test
View Full Code Here

Examples of jodd.datetime.format.JdtFormat.convert()

  @Test
  public void testFormat() {
    JdtFormat format = new JdtFormat(new Iso8601JdtFormatter(), "YYYY+DD+MM");
    JDateTime jdt = new JDateTime(2002, 2, 22);
    assertEquals("2002+22+02", jdt.toString(format));
    assertEquals(format.convert(jdt), jdt.toString(format));
  }

}
View Full Code Here

Examples of jodd.datetime.format.JdtFormatter.convert()

  @Test
  public void testExternalConversion() {
    JdtFormatter fmt = new Iso8601JdtFormatter();
    JDateTime jdt = new JDateTime();
    String s1 = fmt.convert(jdt, "YYYY-MM.DD");
    assertEquals(s1, jdt.toString("YYYY-MM.DD"));
  }


  @Test
View Full Code Here

Examples of jodd.typeconverter.impl.ArrayConverter.convert()

    // handle destination arrays
    if (destinationType.isArray()) {
      ArrayConverter<T> arrayConverter = new ArrayConverter(this, destinationType.getComponentType());

      return (T) arrayConverter.convert(value);
    }

    // handle enums
    if (destinationType.isEnum()) {
      Object[] enums = destinationType.getEnumConstants();
View Full Code Here

Examples of jodd.typeconverter.impl.BigDecimalConverter.convert()

  @Test
  public void testConversion() {
    BigDecimalConverter bigDecimalConverter = new BigDecimalConverter();

    assertNull(bigDecimalConverter.convert(null));

    assertEquals(new BigDecimal("1.2345"), bigDecimalConverter.convert(new BigDecimal("1.2345")));
    assertEquals(new BigDecimal("1.2345"), bigDecimalConverter.convert("1.2345"));
    assertEquals(new BigDecimal("1.2345"), bigDecimalConverter.convert(" 1.2345 "));
    assertEquals(new BigDecimal("1.2345"), bigDecimalConverter.convert(Double.valueOf(1.2345D)));
View Full Code Here

Examples of jodd.typeconverter.impl.BigIntegerConverter.convert()

  @Test
  public void testConversion() {
    BigIntegerConverter bigIntegerConverter = new BigIntegerConverter();

    assertNull(bigIntegerConverter.convert(null));

    assertEquals(new BigInteger("12345"), bigIntegerConverter.convert(new BigInteger("12345")));
    assertEquals(new BigInteger("12345"), bigIntegerConverter.convert("12345"));
    assertEquals(new BigInteger("12345"), bigIntegerConverter.convert(" 12345 "));
    assertEquals(new BigInteger("12345"), bigIntegerConverter.convert(Double.valueOf(12345.0D)));
View Full Code Here

Examples of jodd.typeconverter.impl.BooleanArrayConverter.convert()

  @Test
  public void testConversion() {
    BooleanArrayConverter booleanArrayConverter = (BooleanArrayConverter) TypeConverterManager.lookup(boolean[].class);

    assertNull(booleanArrayConverter.convert(null));

    boolean[] primitiveArray = new boolean[]{false, true, false};
    Object convertedArray = booleanArrayConverter.convert(primitiveArray);
    assertEquals(boolean[].class, convertedArray.getClass());
View Full Code Here

Examples of jodd.typeconverter.impl.BooleanConverter.convert()

  @Test
  public void testConversion() {
    BooleanConverter booleanConverter = new BooleanConverter();

    assertNull(booleanConverter.convert(null));

    assertEquals(Boolean.TRUE, booleanConverter.convert(Boolean.TRUE));

    assertEquals(Boolean.TRUE, booleanConverter.convert("yes"));
    assertEquals(Boolean.TRUE, booleanConverter.convert(" yes "));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.