@Override public ClientComplexValue getComplexValue() { return hasComplexValue() ? getValue().asComplex() : null; }
@Override public ClientComplexValue getComplexValue() { return hasComplexValue() ? getValue().asComplex() : null; }
/** * 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; }
/** * 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; }
protected Object getValue(final ClientValue value) { Object valueResource = null; if (value == null) { return null; } if (value.isEnum()) { valueResource = value.asEnum().getValue(); } else if (value.isPrimitive()) { valueResource = value.asPrimitive().toValue(); } else if (value.isComplex()) { List<Property> complexProperties = new ArrayList<Property>(); for (final ClientProperty propertyValue : value.asComplex()) { complexProperties.add(getProperty(propertyValue)); } final ComplexValue lcValueResource = new ComplexValue(); lcValueResource.getValue().addAll(complexProperties); annotations(value.asComplex(), lcValueResource); links(value.asComplex(), lcValueResource); lcValueResource.setTypeName(value.asComplex().getTypeName()); valueResource = lcValueResource; } else if (value.isCollection()) { final ClientCollectionValue<? extends ClientValue> _value = value.asCollection(); ArrayList<Object> lcValueResource = new ArrayList<Object>(); for (final ClientValue collectionValue : _value) { lcValueResource.add(getValue(collectionValue)); } valueResource = lcValueResource; } return valueResource; }
@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; }
value.asComplex(), actualRef, service,
@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; }
value.asComplex(), actualRef, service,
protected Object getValue(final ClientValue value) { Object valueResource = null; if (value == null) { return null; } if (value.isEnum()) { valueResource = value.asEnum().getValue(); } else if (value.isPrimitive()) { valueResource = value.asPrimitive().toValue(); } else if (value.isComplex()) { List<Property> complexProperties = new ArrayList<Property>(); for (final ClientProperty propertyValue : value.asComplex()) { complexProperties.add(getProperty(propertyValue)); } final ComplexValue lcValueResource = new ComplexValue(); lcValueResource.getValue().addAll(complexProperties); annotations(value.asComplex(), lcValueResource); links(value.asComplex(), lcValueResource); lcValueResource.setTypeName(value.asComplex().getTypeName()); valueResource = lcValueResource; } else if (value.isCollection()) { final ClientCollectionValue<? extends ClientValue> _value = value.asCollection(); ArrayList<Object> lcValueResource = new ArrayList<Object>(); for (final ClientValue collectionValue : _value) { lcValueResource.add(getValue(collectionValue)); } valueResource = lcValueResource; } return valueResource; }
value.asComplex(), actualRef, service,
value.asComplex(), actualRef, service,
Thread.currentThread().getContextClassLoader(), new Class<?>[] { internalRef }, ComplexInvocationHandler.getInstance(value.asComplex(), internalRef, service)); } else if (value.isCollection()) { final ArrayList<Object> collection = new ArrayList<Object>(); Thread.currentThread().getContextClassLoader(), new Class<?>[] { internalRef }, ComplexInvocationHandler.getInstance(itemValue.asComplex(), internalRef, service));
} else if (param.getValue().isComplex()) { property = odataClient.getObjectFactory(). newComplexProperty(param.getKey(), param.getValue().asComplex()); } else if (param.getValue().isCollection()) { property = odataClient.getObjectFactory().
} else if (param.getValue().isComplex()) { property = odataClient.getObjectFactory(). newComplexProperty(param.getKey(), param.getValue().asComplex()); } else if (param.getValue().isCollection()) { property = odataClient.getObjectFactory().
Thread.currentThread().getContextClassLoader(), new Class<?>[] { internalRef }, ComplexInvocationHandler.getInstance(value.asComplex(), internalRef, service)); } else if (value.isCollection()) { final ArrayList<Object> collection = new ArrayList<Object>(); Thread.currentThread().getContextClassLoader(), new Class<?>[] { internalRef }, ComplexInvocationHandler.getInstance(itemValue.asComplex(), internalRef, service));
value.asCollection().add((getODataValue(client, intType, collectionItem)).asEnum()); } else if (intType.isComplexType()) { value.asCollection().add(getODataValue(client, intType, collectionItem).asComplex()); } else { throw new UnsupportedOperationException("Unsupported object type " + intType.getFullQualifiedName()); .entrySet()) { try { value.asComplex().add(getODataComplexProperty( client, type.getFullQualifiedName(), changes.getKey(), changes.getValue())); } catch (Exception ignore) {
value.asCollection().add((getODataValue(client, intType, collectionItem)).asEnum()); } else if (intType.isComplexType()) { value.asCollection().add(getODataValue(client, intType, collectionItem).asComplex()); } else { throw new UnsupportedOperationException("Unsupported object type " + intType.getFullQualifiedName()); .entrySet()) { try { value.asComplex().add(getODataComplexProperty( client, type.getFullQualifiedName(), changes.getKey(), changes.getValue())); } catch (Exception ignore) {
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); } }
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); } }