/** * Creates a new OData property of the given edm-type. * * @param <T> the property value's java-type * @param name the property name * @param type the property edm-type * @param value the property value * @return a new OData property instance */ public static <T> OProperty<T> simple(String name, EdmSimpleType<T> type, Object value) { OSimpleObject<T> simple = OSimpleObjects.create(type, value); return new Impl<T>(name, type, simple.getValue()); }
/** * Creates a new OData property of the given edm-type. * * @param <T> the property value's java-type * @param name the property name * @param type the property edm-type * @param value the property value * @return a new OData property instance */ public static <T> OProperty<T> simple(String name, EdmSimpleType<T> type, Object value) { OSimpleObject<T> simple = OSimpleObjects.create(type, value); return new Impl<T>(name, type, simple.getValue()); }
/** * Creates a new OData property of the given edm-type. * * @param <T> the property value's java-type * @param name the property name * @param type the property edm-type * @param value the property value * @return a new OData property instance */ public static <T> OProperty<T> simple(String name, EdmSimpleType<T> type, Object value) { OSimpleObject<T> simple = OSimpleObjects.create(type, value); return new Impl<T>(name, type, simple.getValue()); }
/** * Creates a new OData property of the given edm-type with a value parsed from a string. * * @param name the property name * @param type the property edm-type * @param value the property value * @return a new OData property instance */ @SuppressWarnings({ "unchecked", "rawtypes" }) public static OProperty<?> parseSimple(String name, EdmSimpleType type, String value) { if (type == null) type = EdmSimpleType.STRING; OSimpleObject<?> simple = OSimpleObjects.parse(type, value); return new Impl(name, type, simple.getValue()); }
/** * Creates a new OData property of the given edm-type with a value parsed from a string. * * @param name the property name * @param type the property edm-type * @param value the property value * @return a new OData property instance */ @SuppressWarnings({ "unchecked", "rawtypes" }) public static OProperty<?> parseSimple(String name, EdmSimpleType type, String value) { if (type == null) type = EdmSimpleType.STRING; OSimpleObject<?> simple = OSimpleObjects.parse(type, value); return new Impl(name, type, simple.getValue()); }
/** * Creates a new OData property of the given edm-type with a value parsed from a string. * * @param name the property name * @param type the property edm-type * @param value the property value * @return a new OData property instance */ @SuppressWarnings({ "unchecked", "rawtypes" }) public static OProperty<?> parseSimple(String name, EdmSimpleType type, String value) { if (type == null) type = EdmSimpleType.STRING; OSimpleObject<?> simple = OSimpleObjects.parse(type, value); return new Impl(name, type, simple.getValue()); }
while(it.hasNext()) { OSimpleObject<?> item = (OSimpleObject<?>)it.next(); result.add(retrieveValue(item.getValue(),expectedType.getComponentType()));
@SuppressWarnings("rawtypes") private void writeCollection(XMLWriter2 writer, String name, OCollection<? extends OObject> c) { Iterator<? extends OObject> iter = c.iterator(); while (iter.hasNext()) { OObject o = iter.next(); if (o instanceof OComplexObject) { writeProperty(writer, "element", o.getType(), o, false, false); } else if (o instanceof OSimpleObject) { writeProperty(writer, "element", o.getType(), ((OSimpleObject) o).getValue(), false, false); // not a doc element and don't write the typename } else { // TODO... } } }
return binary((byte[]) prop.getValue()); if (edmType.equals(EdmSimpleType.BOOLEAN)) return boolean_((Boolean) prop.getValue()); if (edmType.equals(EdmSimpleType.DATETIME)) return dateTime((LocalDateTime) prop.getValue()); if (edmType.equals(EdmSimpleType.DATETIMEOFFSET)) return dateTimeOffset((DateTime) prop.getValue()); if (edmType.equals(EdmSimpleType.DECIMAL)) return decimal((BigDecimal) prop.getValue()); if (edmType.equals(EdmSimpleType.DOUBLE)) return double_((Double) prop.getValue()); if (edmType.equals(EdmSimpleType.STRING)) return string((String) prop.getValue()); if (edmType.equals(EdmSimpleType.GUID)) return guid((Guid) prop.getValue()); if (edmType.equals(EdmSimpleType.INT64)) return int64((Long) prop.getValue()); if (edmType.equals(EdmSimpleType.INT32) || edmType.equals(EdmSimpleType.INT16)) return integral(Integer.parseInt(prop.getValue().toString())); if (edmType.equals(EdmSimpleType.SINGLE)) return single((Float) prop.getValue()); if (edmType.equals(EdmSimpleType.TIME)) return time((LocalTime) prop.getValue()); if (edmType.equals(EdmSimpleType.BYTE)) return byte_((UnsignedByte) prop.getValue()); if (edmType.equals(EdmSimpleType.SBYTE)) return sbyte_((Byte) prop.getValue()); throw new UnsupportedOperationException("Cannot infer literal expression type for edm type: " + edmType);
return binary((byte[]) prop.getValue()); if (edmType.equals(EdmSimpleType.BOOLEAN)) return boolean_((Boolean) prop.getValue()); if (edmType.equals(EdmSimpleType.DATETIME)) return dateTime((LocalDateTime) prop.getValue()); if (edmType.equals(EdmSimpleType.DATETIMEOFFSET)) return dateTimeOffset((DateTime) prop.getValue()); if (edmType.equals(EdmSimpleType.DECIMAL)) return decimal((BigDecimal) prop.getValue()); if (edmType.equals(EdmSimpleType.DOUBLE)) return double_((Double) prop.getValue()); if (edmType.equals(EdmSimpleType.STRING)) return string((String) prop.getValue()); if (edmType.equals(EdmSimpleType.GUID)) return guid((Guid) prop.getValue()); if (edmType.equals(EdmSimpleType.INT64)) return int64((Long) prop.getValue()); if (edmType.equals(EdmSimpleType.INT32) || edmType.equals(EdmSimpleType.INT16)) return integral(Integer.parseInt(prop.getValue().toString())); if (edmType.equals(EdmSimpleType.SINGLE)) return single((Float) prop.getValue()); if (edmType.equals(EdmSimpleType.TIME)) return time((LocalTime) prop.getValue()); if (edmType.equals(EdmSimpleType.BYTE)) return byte_((UnsignedByte) prop.getValue()); if (edmType.equals(EdmSimpleType.SBYTE)) return sbyte_((Byte) prop.getValue()); throw new UnsupportedOperationException("Cannot infer literal expression type for edm type: " + edmType);
return binary((byte[]) prop.getValue()); if (edmType.equals(EdmSimpleType.BOOLEAN)) return boolean_((Boolean) prop.getValue()); if (edmType.equals(EdmSimpleType.DATETIME)) return dateTime((LocalDateTime) prop.getValue()); if (edmType.equals(EdmSimpleType.DATETIMEOFFSET)) return dateTimeOffset((DateTime) prop.getValue()); if (edmType.equals(EdmSimpleType.DECIMAL)) return decimal((BigDecimal) prop.getValue()); if (edmType.equals(EdmSimpleType.DOUBLE)) return double_((Double) prop.getValue()); if (edmType.equals(EdmSimpleType.STRING)) return string((String) prop.getValue()); if (edmType.equals(EdmSimpleType.GUID)) return guid((Guid) prop.getValue()); if (edmType.equals(EdmSimpleType.INT64)) return int64((Long) prop.getValue()); if (edmType.equals(EdmSimpleType.INT32) || edmType.equals(EdmSimpleType.INT16)) return integral(Integer.parseInt(prop.getValue().toString())); if (edmType.equals(EdmSimpleType.SINGLE)) return single((Float) prop.getValue()); if (edmType.equals(EdmSimpleType.TIME)) return time((LocalTime) prop.getValue()); if (edmType.equals(EdmSimpleType.BYTE)) return byte_((UnsignedByte) prop.getValue()); if (edmType.equals(EdmSimpleType.SBYTE)) return sbyte_((Byte) prop.getValue()); throw new UnsupportedOperationException("Cannot infer literal expression type for edm type: " + edmType);
private static String toUriString(OFunctionParameter p) { OObject obj = p.getValue(); if (obj instanceof OSimpleObject) { OSimpleObject<?> simple = (OSimpleObject<?>) obj; LiteralExpression le = Expression.literal(simple.getType(), simple.getValue()); return Expression.asFilterString(le); } throw new UnsupportedOperationException("type not supported: " + obj.getType().getFullyQualifiedTypeName()); }
private static String toUriString(OFunctionParameter p) { OObject obj = p.getValue(); if (obj instanceof OSimpleObject) { OSimpleObject<?> simple = (OSimpleObject<?>) obj; LiteralExpression le = Expression.literal(simple.getType(), simple.getValue()); return Expression.asFilterString(le); } throw new UnsupportedOperationException("type not supported: " + obj.getType().getFullyQualifiedTypeName()); }
@SuppressWarnings("rawtypes") private void writeCollection(XMLWriter2 writer, String name, OCollection<? extends OObject> c) { Iterator<? extends OObject> iter = c.iterator(); while (iter.hasNext()) { OObject o = iter.next(); if (o instanceof OComplexObject) { writeProperty(writer, "element", o.getType(), o, false, false); } else if (o instanceof OSimpleObject) { writeProperty(writer, "element", o.getType(), ((OSimpleObject) o).getValue(), false, false); // not a doc element and don't write the typename } else if (o instanceof OCollection) { writer.startElement("d:element"); writer.writeAttribute("m:type", "Collection("+((OCollection<?>)o).getType().getFullyQualifiedTypeName()+")"); writeCollection(writer, "element", (OCollection<?>)o); writer.endElement("d:element"); } else { // TODO... } } }
writeComplexObject(jw, null, obj.getType().getFullyQualifiedTypeName(), ((OComplexObject) obj).getProperties()); } else if (obj instanceof OSimpleObject) { writeValue(jw, obj.getType(), ((OSimpleObject) obj).getValue());
writeComplexObject(jw, null, obj.getType().getFullyQualifiedTypeName(), ((OComplexObject) obj).getProperties()); } else if (obj instanceof OSimpleObject) { writeValue(jw, obj.getType(), ((OSimpleObject) obj).getValue()); } else if (obj instanceof OCollection) { writeCollection(jw, type, (OCollection<?>)obj);
for (OObject item : collection) { if (collection.getType().isSimple()) { pojos.add(((OSimpleObject<?>) item).getValue()); } else {
this.returnValue = this.translator.retrieveValue(object.getValue(), this.visitor.getReturnTypeClass());