@Override public Collection<Object> asJavaCollection() { final List<Object> result = new ArrayList<Object>(); for (ClientValue value : values) { if (value.isPrimitive()) { result.add(value.asPrimitive().toValue()); } else if (value.isComplex()) { result.add(value.asComplex().asJavaMap()); } else if (value.isCollection()) { result.add(value.asCollection().asJavaCollection()); } else if (value.isEnum()) { result.add(value.asEnum().toString()); } } return result; }
private static Class<?> getEnumTypeRef(final AbstractService<?> service, final ClientValue value) { return service.getEnumTypeClass(value.getTypeName().replaceAll("^Collection\\(", "").replaceAll("\\)$", "")); }
/** * Checks if has null value. * * @return 'TRUE' if has null value; 'FALSE' otherwise. */ @Override public boolean hasNullValue() { return value == null || value.isPrimitive() && value.asPrimitive().toValue() == null || value.isComplex() && value.asComplex().asJavaMap().size() == 0; }
public static ClientProperty getODataProperty( final EdmEnabledODataClient client, final String name, final EdmTypeInfo type, final Object obj) { ClientProperty property; try { if (obj == null) { property = client.getObjectFactory().newPrimitiveProperty(name, null); } else { final EdmTypeInfo valueType = type == null ? guessTypeFromObject(client, obj) : type; final ClientValue value = getODataValue(client, valueType, obj); if (valueType.isCollection()) { property = client.getObjectFactory().newCollectionProperty(name, value.asCollection()); } else if (valueType.isPrimitiveType()) { property = client.getObjectFactory().newPrimitiveProperty(name, value.asPrimitive()); } else if (valueType.isComplexType()) { property = client.getObjectFactory().newComplexProperty(name, value.asComplex()); } else if (valueType.isEnumType()) { property = client.getObjectFactory().newEnumProperty(name, value.asEnum()); } else { throw new UnsupportedOperationException("Usupported object type " + valueType.getFullQualifiedName()); } } return property; } catch (Exception e) { throw new IllegalStateException(e); } }
if (value == null) { valueType = ValueType.COLLECTION_PRIMITIVE; } else if (value.isPrimitive()) { valueType = value.asPrimitive().toValue() instanceof Geospatial ? ValueType.COLLECTION_GEOSPATIAL : ValueType.COLLECTION_PRIMITIVE; } else if (value.isEnum()) { valueType = ValueType.COLLECTION_ENUM; } else if (value.isComplex()) { valueType = ValueType.COLLECTION_COMPLEX;
final List items = new ArrayList(); for (ClientValue item : property.getValue().asCollection()) { items.add(ProxyUtils.getComplexProxy( service, final List items = new ArrayList(); for (ClientValue item : property.getValue().asCollection()) { items.add(item.asPrimitive().toValue()); if (returnType.isComplexType()) { res = ProxyUtils.getComplexProxy( service, property.getName(), property.getValue().asComplex(), ref, null, null, false); } else { res = CoreUtils.getObjectFromODataValue(property.getValue(), targetRef, service);
List items = new ArrayList(); for (ClientValue item : property.getValue().asCollection()) { items.add(getComplex( name, } else { List items = new ArrayList(); for (ClientValue item : property.getValue().asCollection()) { items.add(item.asPrimitive().toValue());
@Override public ClientComplexValue getComplexValue() { return hasComplexValue() ? getValue().asComplex() : null; }
@Override public ClientPrimitiveValue getPrimitiveValue() { return hasPrimitiveValue() ? value.asPrimitive() : null; }
@Override public ClientCollectionValue<ClientValue> getCollectionValue() { return hasCollectionValue() ? getValue().<ClientValue> asCollection() : null; }
@Override public boolean hasCollectionValue() { return !hasNullValue() && value.isCollection(); }
@Override public boolean hasEnumValue() { return !hasNullValue() && getValue().isEnum(); }
@Override public ClientEnumValue getEnumValue() { return hasEnumValue() ? getValue().asEnum() : null; }
@Override public boolean hasPrimitiveValue() { return value != null && value.isPrimitive(); }
@Override public boolean hasComplexValue() { return value != null && value.isComplex(); }
/** * Checks if has null value. * * @return 'TRUE' if has null value; 'FALSE' otherwise. */ @Override public boolean hasNullValue() { return value == null || value.isPrimitive() && value.asPrimitive().toValue() == null || value.isComplex() && value.asComplex().asJavaMap().size() == 0; }
public static ClientProperty getODataProperty( final EdmEnabledODataClient client, final String name, final EdmTypeInfo type, final Object obj) { ClientProperty property; try { if (obj == null) { property = client.getObjectFactory().newPrimitiveProperty(name, null); } else { final EdmTypeInfo valueType = type == null ? guessTypeFromObject(client, obj) : type; final ClientValue value = getODataValue(client, valueType, obj); if (valueType.isCollection()) { property = client.getObjectFactory().newCollectionProperty(name, value.asCollection()); } else if (valueType.isPrimitiveType()) { property = client.getObjectFactory().newPrimitiveProperty(name, value.asPrimitive()); } else if (valueType.isComplexType()) { property = client.getObjectFactory().newComplexProperty(name, value.asComplex()); } else if (valueType.isEnumType()) { property = client.getObjectFactory().newEnumProperty(name, value.asEnum()); } else { throw new UnsupportedOperationException("Usupported object type " + valueType.getFullQualifiedName()); } } return property; } catch (Exception e) { throw new IllegalStateException(e); } }
if (value == null) { valueType = ValueType.COLLECTION_PRIMITIVE; } else if (value.isPrimitive()) { valueType = value.asPrimitive().toValue() instanceof Geospatial ? ValueType.COLLECTION_GEOSPATIAL : ValueType.COLLECTION_PRIMITIVE; } else if (value.isEnum()) { valueType = ValueType.COLLECTION_ENUM; } else if (value.isComplex()) { valueType = ValueType.COLLECTION_COMPLEX;
final List items = new ArrayList(); for (ClientValue item : property.getValue().asCollection()) { items.add(ProxyUtils.getComplexProxy( service, final List items = new ArrayList(); for (ClientValue item : property.getValue().asCollection()) { items.add(item.asPrimitive().toValue()); if (returnType.isComplexType()) { res = ProxyUtils.getComplexProxy( service, property.getName(), property.getValue().asComplex(), ref, null, null, false); } else { res = CoreUtils.getObjectFromODataValue(property.getValue(), targetRef, service);
List items = new ArrayList(); for (ClientValue item : property.getValue().asCollection()) { items.add(getComplex( name, } else { List items = new ArrayList(); for (ClientValue item : property.getValue().asCollection()) { items.add(item.asPrimitive().toValue());