use of org.odata4j.core.OObject in project teiid by teiid.
the class ODataUpdateVisitor method readProperty.
private OProperty<?> readProperty(Column column, Object value) {
if (value instanceof Array) {
EdmType componentType = ODataTypeManager.odataType(column.getRuntimeType());
if (componentType instanceof EdmCollectionType) {
componentType = ((EdmCollectionType) componentType).getItemType();
}
OCollection.Builder<OObject> b = OCollections.newBuilder(componentType);
List<Expression> values = ((Array) value).getExpressions();
for (int i = 0; i < values.size(); i++) {
Literal literal = (Literal) values.get(i);
b.add(OSimpleObjects.create((EdmSimpleType<?>) componentType, literal.getValue()));
}
return OProperties.collection(column.getName(), new EdmCollectionType(CollectionKind.Collection, componentType), b.build());
} else {
Literal literal = (Literal) value;
return OProperties.simple(column.getName(), literal.getValue());
}
}
Aggregations