Examples of valueOfString()


Examples of org.apache.olingo.odata2.api.edm.EdmSimpleType.valueOfString()

    assertEquals(Short.valueOf((short) 1), instance.valueOfString("1", EdmLiteralKind.DEFAULT, null, Short.class));
    assertEquals(Integer.valueOf(2), instance.valueOfString("2", EdmLiteralKind.JSON, null, Integer.class));
    assertEquals(Long.valueOf(-1234567890123456789L), instance.valueOfString("-1234567890123456789L",
        EdmLiteralKind.URI, null, Long.class));
    assertEquals(BigInteger.ONE, instance.valueOfString("1", EdmLiteralKind.DEFAULT, null, BigInteger.class));
    assertEquals(Long.valueOf(0), instance.valueOfString("0l", EdmLiteralKind.URI, null, Long.class));
    assertEquals(Byte.valueOf((byte) 0), instance.valueOfString("0L", EdmLiteralKind.URI, null, Byte.class));

    expectErrorInValueOfString(instance, "-12345678901234567890", EdmLiteralKind.DEFAULT, null,
        EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
    expectErrorInValueOfString(instance, "1.0", EdmLiteralKind.DEFAULT, null,
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.EdmSimpleType.valueOfString()

    assertEquals(Integer.valueOf(2), instance.valueOfString("2", EdmLiteralKind.JSON, null, Integer.class));
    assertEquals(Long.valueOf(-1234567890123456789L), instance.valueOfString("-1234567890123456789L",
        EdmLiteralKind.URI, null, Long.class));
    assertEquals(BigInteger.ONE, instance.valueOfString("1", EdmLiteralKind.DEFAULT, null, BigInteger.class));
    assertEquals(Long.valueOf(0), instance.valueOfString("0l", EdmLiteralKind.URI, null, Long.class));
    assertEquals(Byte.valueOf((byte) 0), instance.valueOfString("0L", EdmLiteralKind.URI, null, Byte.class));

    expectErrorInValueOfString(instance, "-12345678901234567890", EdmLiteralKind.DEFAULT, null,
        EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
    expectErrorInValueOfString(instance, "1.0", EdmLiteralKind.DEFAULT, null,
        EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.EdmSimpleType.valueOfString()

  @Test
  public void valueOfStringSByte() throws Exception {
    final EdmSimpleType instance = EdmSimpleTypeKind.SByte.getEdmSimpleTypeInstance();

    assertEquals(Byte.valueOf((byte) 1), instance.valueOfString("1", EdmLiteralKind.DEFAULT, null, Byte.class));
    assertEquals(Short.valueOf((short) -2), instance.valueOfString("-2", EdmLiteralKind.JSON, null, Short.class));
    assertEquals(Byte.valueOf((byte) 127), instance.valueOfString("127", EdmLiteralKind.URI, null, Byte.class));
    assertEquals(Byte.valueOf((byte) -128), instance.valueOfString("-128", EdmLiteralKind.URI, null, Byte.class));
    assertEquals(Integer.valueOf(0), instance.valueOfString("0", EdmLiteralKind.DEFAULT, null, Integer.class));
    assertEquals(Long.valueOf(0), instance.valueOfString("0", EdmLiteralKind.DEFAULT, null, Long.class));
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.EdmSimpleType.valueOfString()

  @Test
  public void valueOfStringSByte() throws Exception {
    final EdmSimpleType instance = EdmSimpleTypeKind.SByte.getEdmSimpleTypeInstance();

    assertEquals(Byte.valueOf((byte) 1), instance.valueOfString("1", EdmLiteralKind.DEFAULT, null, Byte.class));
    assertEquals(Short.valueOf((short) -2), instance.valueOfString("-2", EdmLiteralKind.JSON, null, Short.class));
    assertEquals(Byte.valueOf((byte) 127), instance.valueOfString("127", EdmLiteralKind.URI, null, Byte.class));
    assertEquals(Byte.valueOf((byte) -128), instance.valueOfString("-128", EdmLiteralKind.URI, null, Byte.class));
    assertEquals(Integer.valueOf(0), instance.valueOfString("0", EdmLiteralKind.DEFAULT, null, Integer.class));
    assertEquals(Long.valueOf(0), instance.valueOfString("0", EdmLiteralKind.DEFAULT, null, Long.class));
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.EdmSimpleType.valueOfString()

  public void valueOfStringSByte() throws Exception {
    final EdmSimpleType instance = EdmSimpleTypeKind.SByte.getEdmSimpleTypeInstance();

    assertEquals(Byte.valueOf((byte) 1), instance.valueOfString("1", EdmLiteralKind.DEFAULT, null, Byte.class));
    assertEquals(Short.valueOf((short) -2), instance.valueOfString("-2", EdmLiteralKind.JSON, null, Short.class));
    assertEquals(Byte.valueOf((byte) 127), instance.valueOfString("127", EdmLiteralKind.URI, null, Byte.class));
    assertEquals(Byte.valueOf((byte) -128), instance.valueOfString("-128", EdmLiteralKind.URI, null, Byte.class));
    assertEquals(Integer.valueOf(0), instance.valueOfString("0", EdmLiteralKind.DEFAULT, null, Integer.class));
    assertEquals(Long.valueOf(0), instance.valueOfString("0", EdmLiteralKind.DEFAULT, null, Long.class));

    expectErrorInValueOfString(instance, "128", EdmLiteralKind.DEFAULT, null,
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.EdmSimpleType.valueOfString()

    final EdmSimpleType instance = EdmSimpleTypeKind.SByte.getEdmSimpleTypeInstance();

    assertEquals(Byte.valueOf((byte) 1), instance.valueOfString("1", EdmLiteralKind.DEFAULT, null, Byte.class));
    assertEquals(Short.valueOf((short) -2), instance.valueOfString("-2", EdmLiteralKind.JSON, null, Short.class));
    assertEquals(Byte.valueOf((byte) 127), instance.valueOfString("127", EdmLiteralKind.URI, null, Byte.class));
    assertEquals(Byte.valueOf((byte) -128), instance.valueOfString("-128", EdmLiteralKind.URI, null, Byte.class));
    assertEquals(Integer.valueOf(0), instance.valueOfString("0", EdmLiteralKind.DEFAULT, null, Integer.class));
    assertEquals(Long.valueOf(0), instance.valueOfString("0", EdmLiteralKind.DEFAULT, null, Long.class));

    expectErrorInValueOfString(instance, "128", EdmLiteralKind.DEFAULT, null,
        EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.EdmSimpleType.valueOfString()

    assertEquals(Byte.valueOf((byte) 1), instance.valueOfString("1", EdmLiteralKind.DEFAULT, null, Byte.class));
    assertEquals(Short.valueOf((short) -2), instance.valueOfString("-2", EdmLiteralKind.JSON, null, Short.class));
    assertEquals(Byte.valueOf((byte) 127), instance.valueOfString("127", EdmLiteralKind.URI, null, Byte.class));
    assertEquals(Byte.valueOf((byte) -128), instance.valueOfString("-128", EdmLiteralKind.URI, null, Byte.class));
    assertEquals(Integer.valueOf(0), instance.valueOfString("0", EdmLiteralKind.DEFAULT, null, Integer.class));
    assertEquals(Long.valueOf(0), instance.valueOfString("0", EdmLiteralKind.DEFAULT, null, Long.class));

    expectErrorInValueOfString(instance, "128", EdmLiteralKind.DEFAULT, null,
        EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
    expectErrorInValueOfString(instance, "-129", EdmLiteralKind.JSON, null,
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.EdmSimpleType.valueOfString()

    assertEquals(Byte.valueOf((byte) 1), instance.valueOfString("1", EdmLiteralKind.DEFAULT, null, Byte.class));
    assertEquals(Short.valueOf((short) -2), instance.valueOfString("-2", EdmLiteralKind.JSON, null, Short.class));
    assertEquals(Byte.valueOf((byte) 127), instance.valueOfString("127", EdmLiteralKind.URI, null, Byte.class));
    assertEquals(Byte.valueOf((byte) -128), instance.valueOfString("-128", EdmLiteralKind.URI, null, Byte.class));
    assertEquals(Integer.valueOf(0), instance.valueOfString("0", EdmLiteralKind.DEFAULT, null, Integer.class));
    assertEquals(Long.valueOf(0), instance.valueOfString("0", EdmLiteralKind.DEFAULT, null, Long.class));

    expectErrorInValueOfString(instance, "128", EdmLiteralKind.DEFAULT, null,
        EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
    expectErrorInValueOfString(instance, "-129", EdmLiteralKind.JSON, null,
        EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.EdmSimpleType.valueOfString()

  @Test
  public void valueOfStringSingle() throws Exception {
    final EdmSimpleType instance = EdmSimpleTypeKind.Single.getEdmSimpleTypeInstance();

    assertEquals(Float.valueOf(1.42F), instance.valueOfString("1.42", EdmLiteralKind.DEFAULT, null, Float.class));
    assertEquals(Float.valueOf(1.000000001F),
        instance.valueOfString("1.00000001", EdmLiteralKind.DEFAULT, null, Float.class));
    assertEquals(Double.valueOf(-42.42), instance.valueOfString("-42.42", EdmLiteralKind.JSON, null, Double.class));
    assertEquals(Float.valueOf(42.0F), instance.valueOfString("42F", EdmLiteralKind.URI, null, Float.class));
    assertEquals(Float.valueOf(2.2E38F), instance.valueOfString("22E37f", EdmLiteralKind.URI, null, Float.class));
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.EdmSimpleType.valueOfString()

  public void valueOfStringSingle() throws Exception {
    final EdmSimpleType instance = EdmSimpleTypeKind.Single.getEdmSimpleTypeInstance();

    assertEquals(Float.valueOf(1.42F), instance.valueOfString("1.42", EdmLiteralKind.DEFAULT, null, Float.class));
    assertEquals(Float.valueOf(1.000000001F),
        instance.valueOfString("1.00000001", EdmLiteralKind.DEFAULT, null, Float.class));
    assertEquals(Double.valueOf(-42.42), instance.valueOfString("-42.42", EdmLiteralKind.JSON, null, Double.class));
    assertEquals(Float.valueOf(42.0F), instance.valueOfString("42F", EdmLiteralKind.URI, null, Float.class));
    assertEquals(Float.valueOf(2.2E38F), instance.valueOfString("22E37f", EdmLiteralKind.URI, null, Float.class));
    assertEquals(BigDecimal.TEN, instance.valueOfString("10F", EdmLiteralKind.URI, null, BigDecimal.class));
    assertEquals(Byte.valueOf((byte) 0), instance.valueOfString("0", EdmLiteralKind.JSON, null, Byte.class));
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.