Search in sources :

Example 1 with IonDecimal

use of com.amazon.ion.IonDecimal in project ion-java by amzn.

the class _Private_CurriedValueFactory method newDecimal.

public IonDecimal newDecimal(BigDecimal value) {
    IonDecimal v = myFactory.newDecimal(value);
    handle(v);
    return v;
}
Also used : IonDecimal(com.amazon.ion.IonDecimal)

Example 2 with IonDecimal

use of com.amazon.ion.IonDecimal in project ion-java by amzn.

the class _Private_CurriedValueFactory method newNullDecimal.

// -------------------------------------------------------------------------
public IonDecimal newNullDecimal() {
    IonDecimal v = myFactory.newNullDecimal();
    handle(v);
    return v;
}
Also used : IonDecimal(com.amazon.ion.IonDecimal)

Example 3 with IonDecimal

use of com.amazon.ion.IonDecimal in project ion-java by amzn.

the class _Private_CurriedValueFactory method newDecimal.

public IonDecimal newDecimal(BigInteger value) {
    IonDecimal v = myFactory.newDecimal(value);
    handle(v);
    return v;
}
Also used : IonDecimal(com.amazon.ion.IonDecimal)

Example 4 with IonDecimal

use of com.amazon.ion.IonDecimal in project ion-java by amzn.

the class _Private_CurriedValueFactory method newDecimal.

public IonDecimal newDecimal(double value) {
    IonDecimal v = myFactory.newDecimal(value);
    handle(v);
    return v;
}
Also used : IonDecimal(com.amazon.ion.IonDecimal)

Example 5 with IonDecimal

use of com.amazon.ion.IonDecimal in project ion-java by amzn.

the class PrinterTest method testPrintingDecimal.

@Test
public void testPrintingDecimal() throws Exception {
    IonDecimal value = system().newNullDecimal();
    checkNullRendering("null.decimal", value);
    value.setValue(-123);
    checkRendering("-123.", value);
    value.setValue(456);
    checkRendering("456.", value);
    value.setValue(0);
    checkRendering("0.", value);
    value.addTypeAnnotation("an");
    checkRendering("an::0.", value);
    value = (IonDecimal) oneValue("0d42");
    checkRendering("0d42", value);
    value = (IonDecimal) oneValue("0d+42");
    checkRendering("0d42", value);
    value = (IonDecimal) oneValue("0d-42");
    checkRendering("0d-42", value);
    value = (IonDecimal) oneValue("100d-1");
    checkRendering("10.0", value);
    value = (IonDecimal) oneValue("100d3");
    checkRendering("100d3", value);
    myPrinter.setPrintDecimalAsFloat(true);
    checkRendering("100e3", value);
}
Also used : IonDecimal(com.amazon.ion.IonDecimal) Test(org.junit.Test) IntTest(com.amazon.ion.IntTest) BlobTest(com.amazon.ion.BlobTest) ClobTest(com.amazon.ion.ClobTest)

Aggregations

IonDecimal (com.amazon.ion.IonDecimal)9 Test (org.junit.Test)2 BlobTest (com.amazon.ion.BlobTest)1 ClobTest (com.amazon.ion.ClobTest)1 IntTest (com.amazon.ion.IntTest)1 IonBlob (com.amazon.ion.IonBlob)1 IonBool (com.amazon.ion.IonBool)1 IonClob (com.amazon.ion.IonClob)1 IonFloat (com.amazon.ion.IonFloat)1 IonInt (com.amazon.ion.IonInt)1 IonList (com.amazon.ion.IonList)1 IonNull (com.amazon.ion.IonNull)1 IonSexp (com.amazon.ion.IonSexp)1 IonString (com.amazon.ion.IonString)1 IonStruct (com.amazon.ion.IonStruct)1 IonSymbol (com.amazon.ion.IonSymbol)1 IonTimestamp (com.amazon.ion.IonTimestamp)1 IonObjectMapper (com.fasterxml.jackson.dataformat.ion.IonObjectMapper)1 BigDecimal (java.math.BigDecimal)1 Instant (java.time.Instant)1