protected OCollection.Builder<OObject> newCollectionBuilder() { return OCollections.<OObject> newBuilder(this.returnType.getItemType()); }
protected OCollection.Builder<OObject> newCollectionBuilder() { return OCollections.<OObject> newBuilder(this.returnType.getItemType()); }
@Override public List<EdmAnnotation<?>> getAnnotationsForSchema(String namespace) { List<EdmAnnotation<?>> annots = new ArrayList<EdmAnnotation<?>>(); annots.add(new EdmAnnotationAttribute(namespace, prefix, "Version", "1.0 early experience pre-alpha")); List<OProperty<?>> p = new ArrayList<OProperty<?>>(); p.add(OProperties.string("Author", "Xavier S. Dumont")); p.add(OProperties.string("SeeAlso", "InMemoryProducerExample.java")); annots.add(EdmAnnotation.element(namespace, prefix, "SchemaInfo", OComplexObject.class, OComplexObjects.create(schemaInfoType, p))); annots.add(EdmAnnotation.element(namespace, prefix, "Tags", OCollection.class, OCollections.newBuilder(EdmSimpleType.STRING) .add(OSimpleObjects.create(EdmSimpleType.STRING, "tag1")) .add(OSimpleObjects.create(EdmSimpleType.STRING, "tag2")) .build())); return annots; }
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()); } }
Builder<OComplexObject> builder = OCollections.newBuilder(propRefType); for (String key : ((EdmEntityType) st).getKeys()) { List<OProperty<?>> refProps = new ArrayList<OProperty<?>>();
Builder<OComplexObject> builder = OCollections.newBuilder(propRefType); for (String key : ((EdmEntityType) st).getKeys()) { List<OProperty<?>> refProps = new ArrayList<OProperty<?>>();
OCollection.Builder<OObject> b = OCollections.newBuilder(property.getType()); if (values != null) { Class<?> propType = propertyModel.getCollectionElementType(property.getName());
private static OProperty<?> readCollection(String name, EdmCollectionType collectionType, XMLEventReader2 reader, StartElement2 collectionElement, EdmDataServices metadata, EdmStructuralType structuralType) { EdmType componentType = collectionType.getItemType(); OCollection.Builder<OObject> b = OCollections.newBuilder(componentType); while (reader.hasNext()) { XMLEvent2 event = reader.nextEvent(); if (event.isEndElement() && event.asEndElement().getName().equals(collectionElement.getName())) { break; } if (event.isStartElement() && event.asStartElement().getName().getNamespaceUri().equals(NS_DATASERVICES)) { OProperty<?> op = null; Attribute2 nullAttribute = event.asStartElement().getAttributeByName(M_NULL); boolean isNull = nullAttribute != null && "true".equals(nullAttribute.getValue()); if (!componentType.isSimple()) { EdmStructuralType est = (EdmStructuralType) componentType; op = OProperties.complex(name, (EdmComplexType) componentType, isNull ? null : Enumerable.create(parseProperties(reader, event.asStartElement(), metadata, est)).toList()); } else { op = OProperties.parseSimple(name, (EdmSimpleType<?>) componentType, isNull ? null : reader.getElementText()); } b.add(OSimpleObjects.create((EdmSimpleType<?>)componentType, op.getValue())); } } return OProperties.collection(name, collectionType, b.build()); }