Examples of valueOfString()


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

    if (type == EdmSimpleTypeKind.Binary.getEdmSimpleTypeInstance()) {
      return readBinary(content);
    } else {
      try {
        if (typeMapping == null) {
          return type.valueOfString(readText(content), EdmLiteralKind.DEFAULT, edmProperty.getFacets(), type
              .getDefaultType());
        } else {
          return type.valueOfString(readText(content), EdmLiteralKind.DEFAULT, edmProperty.getFacets(), typeMapping);
        }
      } catch (EdmException e) {
View Full Code Here

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

      try {
        if (typeMapping == null) {
          return type.valueOfString(readText(content), EdmLiteralKind.DEFAULT, edmProperty.getFacets(), type
              .getDefaultType());
        } else {
          return type.valueOfString(readText(content), EdmLiteralKind.DEFAULT, edmProperty.getFacets(), typeMapping);
        }
      } catch (EdmException e) {
        throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
            .getSimpleName()), e);
      }
View Full Code Here

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

  private static Map<String, Object> mapKey(final List<KeyPredicate> keys) throws EdmException {
    Map<String, Object> keyMap = new HashMap<String, Object>();
    for (final KeyPredicate key : keys) {
      final EdmProperty property = key.getProperty();
      final EdmSimpleType type = (EdmSimpleType) property.getType();
      keyMap.put(property.getName(), type.valueOfString(key.getLiteral(), EdmLiteralKind.DEFAULT, property.getFacets(),
          type.getDefaultType()));
    }
    return keyMap;
  }
View Full Code Here

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

    } else {
      Map<String, Object> parameterMap = new HashMap<String, Object>();
      for (final String parameterName : functionImportParameters.keySet()) {
        final EdmLiteral literal = functionImportParameters.get(parameterName);
        final EdmSimpleType type = literal.getType();
        parameterMap.put(parameterName, type.valueOfString(literal.getLiteral(), EdmLiteralKind.DEFAULT, null, type
            .getDefaultType()));
      }
      return parameterMap;
    }
  }
View Full Code Here

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

          .getFacets());

    case LITERAL:
      final LiteralExpression literal = (LiteralExpression) expression;
      final EdmSimpleType literalType = (EdmSimpleType) literal.getEdmType();
      return literalType.valueToString(literalType.valueOfString(literal.getUriLiteral(), EdmLiteralKind.URI, null,
          literalType.getDefaultType()),
          EdmLiteralKind.DEFAULT, null);

    case METHOD:
      final MethodExpression methodExpression = (MethodExpression) expression;
View Full Code Here

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

        getPrecisionScaleFacets(42, null), Integer.class));
    assertEquals(Long.valueOf(-32768), instance.valueOfString("-32768", EdmLiteralKind.DEFAULT,
        getPrecisionScaleFacets(5, null), Long.class));
    assertEquals(BigInteger.valueOf(32768), instance.valueOfString("32768", EdmLiteralKind.DEFAULT,
        getPrecisionScaleFacets(5, null), BigInteger.class));
    assertEquals(Double.valueOf(0.5), instance.valueOfString("0.5", EdmLiteralKind.DEFAULT, getPrecisionScaleFacets(1,
        null), Double.class));
    assertEquals(Float.valueOf(0.5F), instance.valueOfString("0.5", EdmLiteralKind.DEFAULT, getPrecisionScaleFacets(
        null, 1), Float.class));
    assertEquals(new BigDecimal("12.3"), instance.valueOfString("12.3", EdmLiteralKind.DEFAULT,
        getPrecisionScaleFacets(3, 1), BigDecimal.class));
View Full Code Here

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

        getPrecisionScaleFacets(5, null), Long.class));
    assertEquals(BigInteger.valueOf(32768), instance.valueOfString("32768", EdmLiteralKind.DEFAULT,
        getPrecisionScaleFacets(5, null), BigInteger.class));
    assertEquals(Double.valueOf(0.5), instance.valueOfString("0.5", EdmLiteralKind.DEFAULT, getPrecisionScaleFacets(1,
        null), Double.class));
    assertEquals(Float.valueOf(0.5F), instance.valueOfString("0.5", EdmLiteralKind.DEFAULT, getPrecisionScaleFacets(
        null, 1), Float.class));
    assertEquals(new BigDecimal("12.3"), instance.valueOfString("12.3", EdmLiteralKind.DEFAULT,
        getPrecisionScaleFacets(3, 1), BigDecimal.class));

    expectErrorInValueOfString(instance, "-1234", EdmLiteralKind.DEFAULT, getPrecisionScaleFacets(2, null),
View Full Code Here

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

        getPrecisionScaleFacets(5, null), BigInteger.class));
    assertEquals(Double.valueOf(0.5), instance.valueOfString("0.5", EdmLiteralKind.DEFAULT, getPrecisionScaleFacets(1,
        null), Double.class));
    assertEquals(Float.valueOf(0.5F), instance.valueOfString("0.5", EdmLiteralKind.DEFAULT, getPrecisionScaleFacets(
        null, 1), Float.class));
    assertEquals(new BigDecimal("12.3"), instance.valueOfString("12.3", EdmLiteralKind.DEFAULT,
        getPrecisionScaleFacets(3, 1), BigDecimal.class));

    expectErrorInValueOfString(instance, "-1234", EdmLiteralKind.DEFAULT, getPrecisionScaleFacets(2, null),
        EdmSimpleTypeException.LITERAL_FACETS_NOT_MATCHED);
    expectErrorInValueOfString(instance, "1234", EdmLiteralKind.DEFAULT, getPrecisionScaleFacets(3, null),
View Full Code Here

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

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

    assertEquals(Double.valueOf(1.42), instance.valueOfString("1.42", EdmLiteralKind.DEFAULT, null, Double.class));
    assertEquals(Float.valueOf(-42.25F), instance.valueOfString("-42.25", EdmLiteralKind.JSON, null, Float.class));
    assertEquals(Double.valueOf(42.0), instance.valueOfString("42D", EdmLiteralKind.URI, null, Double.class));
    assertEquals(Double.valueOf(42E42), instance.valueOfString("42E42d", EdmLiteralKind.URI, null, Double.class));
    assertEquals(BigDecimal.TEN, instance.valueOfString("10D", EdmLiteralKind.URI, null, BigDecimal.class));
    assertEquals(Byte.valueOf((byte) 0), instance.valueOfString("0", EdmLiteralKind.JSON, null, Byte.class));
View Full Code Here

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

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

    assertEquals(Double.valueOf(1.42), instance.valueOfString("1.42", EdmLiteralKind.DEFAULT, null, Double.class));
    assertEquals(Float.valueOf(-42.25F), instance.valueOfString("-42.25", EdmLiteralKind.JSON, null, Float.class));
    assertEquals(Double.valueOf(42.0), instance.valueOfString("42D", EdmLiteralKind.URI, null, Double.class));
    assertEquals(Double.valueOf(42E42), instance.valueOfString("42E42d", EdmLiteralKind.URI, null, Double.class));
    assertEquals(BigDecimal.TEN, instance.valueOfString("10D", EdmLiteralKind.URI, null, BigDecimal.class));
    assertEquals(Byte.valueOf((byte) 0), instance.valueOfString("0", EdmLiteralKind.JSON, null, Byte.class));
    assertEquals(Short.valueOf((short) 1), instance.valueOfString("1.00", EdmLiteralKind.DEFAULT, null, Short.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.