/** * Creates a new OData property, inferring the edm-type from the value provided, which cannot be null. * * @param <T> the property value's java-type * @param name the property name * @param value the property value * @return a new OData property instance */ public static <T> OProperty<T> simple(String name, T value) { if (value == null) throw new IllegalArgumentException("Cannot infer EdmType if value is null"); EdmSimpleType<T> type = EdmSimpleType.forJavaType(value.getClass()); if (type == null) throw new IllegalArgumentException("Cannot infer EdmType for java type: " + value.getClass().getName()); return simple(name, type, value); }
/** * Creates a new OData property, inferring the edm-type from the value provided, which cannot be null. * * @param <T> the property value's java-type * @param name the property name * @param value the property value * @return a new OData property instance */ public static <T> OProperty<T> simple(String name, T value) { if (value == null) throw new IllegalArgumentException("Cannot infer EdmType if value is null"); EdmSimpleType<T> type = EdmSimpleType.forJavaType(value.getClass()); if (type == null) throw new IllegalArgumentException("Cannot infer EdmType for java type: " + value.getClass().getName()); return simple(name, type, value); }
/** * Creates a new OData property, inferring the edm-type from the value provided, which cannot be null. * * @param <T> the property value's java-type * @param name the property name * @param value the property value * @return a new OData property instance */ public static <T> OProperty<T> simple(String name, T value) { if (value == null) throw new IllegalArgumentException("Cannot infer EdmType if value is null"); EdmSimpleType<T> type = EdmSimpleType.forJavaType(value.getClass()); if (type == null) throw new IllegalArgumentException("Cannot infer EdmType for java type: " + value.getClass().getName()); return simple(name, type, value); }
public OProperty<T> apply(NamedValue<T> input) { return OProperties.simple(input.getName(), input.getValue()); } };
public OProperty<?> apply(NamedValue input) { return OProperties.simple(input.getName(), input.getValue()); } };
public OProperty<T> apply(NamedValue<T> input) { return OProperties.simple(input.getName(), input.getValue()); } };
public OProperty<T> apply(NamedValue<T> input) { return OProperties.simple(input.getName(), input.getValue()); } };
public OProperty<?> apply(NamedValue input) { return OProperties.simple(input.getName(), input.getValue()); } };
public OProperty<?> apply(NamedValue input) { return OProperties.simple(input.getName(), input.getValue()); } };
protected OEntity toOEntity(JdbcMetadataMapping mapping, EdmEntitySet entitySet, ResultSet results) throws SQLException { List<OProperty<?>> properties = new ArrayList<OProperty<?>>(); for (EdmProperty edmProperty : entitySet.getType().getProperties()) { JdbcColumn column = mapping.getMappedColumn(edmProperty); Object value = results.getObject(column.columnName); OProperty<?> property = OProperties.simple(edmProperty.getName(), value); properties.add(property); } OEntityKey entityKey = OEntityKey.infer(entitySet, properties); return OEntities.create(entitySet, entityKey, properties, Collections.<OLink> emptyList()); }
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()); } }
properties.add(OProperties.simple(property.getName(), (EdmSimpleType<? extends Object>) property.getType(), value)); } else {
Object propertyValue = entityInfo.properties.getPropertyValue(target, navProp); OProperty<?> property = OProperties.simple(navProp, (EdmSimpleType<?>) edmType, propertyValue);
OProperty<?> op = OProperties.simple(result.getName(), result.getType(), result.getValue()); context.setResponse(Responses.property(op));