Examples of toPlainString()


Examples of com.wesabe.api.util.money.Money.toPlainString()

    }
   
    @Test
    public void shouldConvertItselfToAMachineReadableString() throws Exception {
      Money oneDollar = new Money(decimal("1.00"), USD);
      assertEquals("1.00", oneDollar.toPlainString());
    }
  }

  public static class One_Dollar_Plus_One_Dollar {
View Full Code Here

Examples of java.math.BigDecimal.toPlainString()

    }

    private void testCompare(long value, int scale) {
        BigDecimal bd = BigDecimal.valueOf(value, scale);
        MutableDecimal md = new MutableDecimal(value, scale);
        assertEquals(bd.toPlainString(), md.toString());
        String message = "value=" + value + ", scale=" + scale;
        if (bd.abs().compareTo(BD_2_63) < 0)
            assertEquals(message, bd.longValue(), md.longValue());
        assertEquals(message, bd.doubleValue(), md.doubleValue(), Math.abs(bd.doubleValue() / 1e15));
View Full Code Here

Examples of java.math.BigDecimal.toPlainString()

  public XmlElement serialize(Object object) {
    // Turn double value of object into a BigDecimal to get the
    // right decimal point format.
    BigDecimal bd = BigDecimal.valueOf(((Number)object).doubleValue());
    return XMLUtil.makeXmlTag(SerializerHandler.TYPE_DOUBLE, bd.toPlainString());
  }

}
View Full Code Here

Examples of java.math.BigDecimal.toPlainString()

        @Override
        public void decimalProperty(PropertyName name, Context context) {
            Cell cell = context.nextCell();
            BigDecimal value = (BigDecimal) context.getValue(name);
            if (value != null) {
                cell.setCellValue(value.toPlainString());
            }
        }

        @Override
        public void stringProperty(PropertyName name, Context context) {
View Full Code Here

Examples of java.math.BigDecimal.toPlainString()

                        }
                        break;
                    case DECIMAL:
                        BigDecimal decimal = rs.getBigDecimal(info.getColumnName());
                        if (!rs.wasNull()) {
                            cell.setCellValue(decimal.toPlainString());
                        }
                        break;
                    case TINY_INT:
                    case SMALL_INT:
                    case INT:
View Full Code Here

Examples of java.math.BigDecimal.toPlainString()

        for ( int i = 0; i < expected.length; i++ ) {
            DTCellValue52 dcv = actual.get( i );
            switch ( dcv.getDataType() ) {
                case NUMERIC:
                    final BigDecimal numeric = (BigDecimal) dcv.getNumericValue();
                    if ( !expected[ i ].equals( numeric.toPlainString() ) ) {
                        return false;
                    }
                    break;
                case NUMERIC_BIGDECIMAL:
                    final BigDecimal numericBigDecimal = (BigDecimal) dcv.getNumericValue();
View Full Code Here

Examples of java.math.BigDecimal.toPlainString()

                        return false;
                    }
                    break;
                case NUMERIC_BIGDECIMAL:
                    final BigDecimal numericBigDecimal = (BigDecimal) dcv.getNumericValue();
                    if ( !expected[ i ].equals( numericBigDecimal.toPlainString() ) ) {
                        return false;
                    }
                    break;
                case NUMERIC_BIGINTEGER:
                    final BigInteger numericBigInteger = (BigInteger) dcv.getNumericValue();
View Full Code Here

Examples of java.math.BigDecimal.toPlainString()

            transaction.setEntranceCode(EntranceCode);
            transaction.setMerchantReturnURL(returnURL);
            Transaction trx = connector.requestTransaction(transaction);
            redirectString = trx.getIssuerAuthenticationURL();
            request.getSession().setAttribute("purchaseID", orderId);
            request.getSession().setAttribute("payAmount", orderTotal.toPlainString());
        } catch (IdealException ex) {
            Debug.logError(ex.getMessage(), module);
            request.setAttribute("_ERROR_MESSAGE_", ex.getConsumerMessage());
            return "error";
        }
View Full Code Here

Examples of java.math.BigDecimal.toPlainString()

        Element packagingTypeElement = UtilXml.addChildElement(packageElement, "PackagingType", requestDoc);
        UtilXml.addChildElementValue(packagingTypeElement, "Code", "00", requestDoc);
        UtilXml.addChildElementValue(packagingTypeElement, "Description", "Unknown PackagingType", requestDoc);
        UtilXml.addChildElementValue(packageElement, "Description", "Package Description", requestDoc);
        Element packageWeightElement = UtilXml.addChildElement(packageElement, "PackageWeight", requestDoc);
        UtilXml.addChildElementValue(packageWeightElement, "Weight", packageWeight.toPlainString(), requestDoc);
        //If product is in shippable Package then it we should have one product per packagemap
        if (packageMap.size() ==1) {
            Iterator<String> i = packageMap.keySet().iterator();
            String productId = i.next();
            Map<String, Object> productInfo = ShipmentWorker.getProductItemInfo(shippableItemInfo, productId);
View Full Code Here

Examples of java.math.BigDecimal.toPlainString()

        buf.setLength(0);
        BigDecimal bg = new BigDecimal(Double.toString(value));
        int scale = Math.abs(value) < 1.0 ? precision : decimals;
        bg = bg.setScale(scale, BigDecimal.ROUND_HALF_UP);
        //buf.append(bg.toString()); // Java 1.4
        buf.append(bg.toPlainString()); // Java 1.5 and more !
        if (buf.indexOf(".") >= 0) {
            for (int i = buf.length() - 1; i > 1 && buf.charAt(i) == '0'; i--) {
                buf.setLength(i);
            }
            if (buf.charAt(buf.length() - 1) == '.') {
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.