/** * For internal use only by data model classes */ public static ODataTypeValueSerializer of( final EdmSimpleTypeKind typeKind ) { return of(typeKind.getEdmSimpleTypeInstance()); }
public static ODataTypeValueSerializer of(final EdmSimpleTypeKind typeKind) { return of(typeKind.getEdmSimpleTypeInstance()); }
private boolean isBooleanProperty(final EdmProperty property) throws EdmException { return property.isSimple() && property.getType() == EdmSimpleTypeKind.Boolean.getEdmSimpleTypeInstance(); }
private boolean isBooleanProperty(final EdmProperty property) throws EdmException { return property.isSimple() && property.getType() == EdmSimpleTypeKind.Boolean.getEdmSimpleTypeInstance(); }
private boolean isBooleanProperty(final EdmProperty property) throws EdmException { return property.isSimple() && property.getType() == EdmSimpleTypeKind.Boolean.getEdmSimpleTypeInstance(); }
private static List<ContentType> getSupportedContentTypes(final EdmProperty property) throws EdmException { if (property != null) { return property.getType() == EdmSimpleTypeKind.Binary.getEdmSimpleTypeInstance() ? Collections.singletonList(property.getMimeType() == null ? ContentType.WILDCARD : ContentType.create(property.getMimeType())) : Arrays.asList(ContentType.TEXT_PLAIN, ContentType.TEXT_PLAIN_CS_UTF_8); } else { return null; } }
private static List<ContentType> getSupportedContentTypes(final EdmProperty property) throws EdmException { if (property != null) { return property.getType() == EdmSimpleTypeKind.Binary.getEdmSimpleTypeInstance() ? Collections.singletonList(property.getMimeType() == null ? ContentType.WILDCARD : ContentType.create(property.getMimeType())) : Arrays.asList(ContentType.TEXT_PLAIN, ContentType.TEXT_PLAIN_CS_UTF_8); } else { return null; } }
private static List<ContentType> getSupportedContentTypes(final EdmProperty property) throws EdmException { return property.getType() == EdmSimpleTypeKind.Binary.getEdmSimpleTypeInstance() ? Arrays.asList(property .getMimeType() == null ? ContentType.WILDCARD : ContentType.create(property.getMimeType())) : Arrays.asList( ContentType.TEXT_PLAIN, ContentType.TEXT_PLAIN_CS_UTF_8); }
private Object convert(final Field field, final String propertyValue) { Class<?> fieldClass = field.getType(); try { EdmProperty property = field.getAnnotation(EdmProperty.class); EdmSimpleTypeKind type = mapTypeKind(property.type()); return type.getEdmSimpleTypeInstance().valueOfString(propertyValue, EdmLiteralKind.DEFAULT, null, fieldClass); } catch (EdmSimpleTypeException ex) { throw new AnnotationRuntimeException("Conversion failed for string property [" + propertyValue + "] on field [" + field + "] with error: " + ex.getMessage(), ex); } }
private Object convert(final Field field, final String propertyValue) { Class<?> fieldClass = field.getType(); try { EdmProperty property = field.getAnnotation(EdmProperty.class); EdmSimpleTypeKind type = mapTypeKind(property.type()); return type.getEdmSimpleTypeInstance().valueOfString(propertyValue, EdmLiteralKind.DEFAULT, null, fieldClass); } catch (EdmSimpleTypeException ex) { throw new ODataRuntimeException("Conversion failed for string property [" + propertyValue + "] on field [" + field + "] with error: " + ex.getMessage(), ex); } }
private Object convert(final Field field, final String propertyValue) { Class<?> fieldClass = field.getType(); try { EdmProperty property = field.getAnnotation(EdmProperty.class); EdmSimpleTypeKind type = mapTypeKind(property.type()); return type.getEdmSimpleTypeInstance().valueOfString(propertyValue, EdmLiteralKind.DEFAULT, null, fieldClass); } catch (EdmSimpleTypeException ex) { throw new AnnotationRuntimeException("Conversion failed for string property [" + propertyValue + "] on field [" + field + "] with error: " + ex.getMessage(), ex); } }
private Object formatValue(EdmSimpleType type , LiteralExpression literal) throws EdmException{ EdmSimpleTypeKind typeKind = EdmSimpleTypeKind.valueOf(type.getName()); String value = literal.getUriLiteral().toString(); EdmSimpleType instance = typeKind.getEdmSimpleTypeInstance();
@Override public ODataResponse executeFunctionImportValue(final GetFunctionImportUriInfo uriInfo, final String contentType) throws ODataException { final EdmFunctionImport functionImport = uriInfo.getFunctionImport(); final EdmSimpleType type = (EdmSimpleType) functionImport.getReturnType().getType(); final Object data = dataSource.readData( functionImport, mapFunctionParameters(uriInfo.getFunctionImportParameters()), null); if (data == null) { throw new ODataNotFoundException(ODataHttpException.COMMON); } ODataResponse response; if (type == EdmSimpleTypeKind.Binary.getEdmSimpleTypeInstance()) { response = EntityProvider.writeBinary(((BinaryData) data).getMimeType(), ((BinaryData) data).getData()); } else { final String value = type.valueToString(data, EdmLiteralKind.DEFAULT, null); response = EntityProvider.writeText(value == null ? "" : value); } return ODataResponse.fromResponse(response).build(); }
@Override public ODataResponse executeFunctionImportValue(final GetFunctionImportUriInfo uriInfo, final String contentType) throws ODataException { final EdmFunctionImport functionImport = uriInfo.getFunctionImport(); final EdmSimpleType type = (EdmSimpleType) functionImport.getReturnType().getType(); final Object data = dataSource.readData( functionImport, mapFunctionParameters(uriInfo.getFunctionImportParameters()), null); if (data == null) { throw new ODataNotFoundException(ODataHttpException.COMMON); } ODataResponse response; if (type == EdmSimpleTypeKind.Binary.getEdmSimpleTypeInstance()) { response = EntityProvider.writeBinary(((BinaryData) data).getMimeType(), ((BinaryData) data).getData()); } else { final String value = type.valueToString(data, EdmLiteralKind.DEFAULT, null); response = EntityProvider.writeText(value == null ? "" : value); } return ODataResponse.fromResponse(response).build(); }
@Override public ODataResponse executeFunctionImportValue(final GetFunctionImportUriInfo uriInfo, final String contentType) throws ODataException { final EdmFunctionImport functionImport = uriInfo.getFunctionImport(); final EdmSimpleType type = (EdmSimpleType) functionImport.getReturnType().getType(); final Object data = dataSource.readData( functionImport, mapFunctionParameters(uriInfo.getFunctionImportParameters()), null); if (data == null) { throw new ODataNotFoundException(ODataHttpException.COMMON); } ODataResponse response; if (type == EdmSimpleTypeKind.Binary.getEdmSimpleTypeInstance()) { response = EntityProvider.writeBinary(((BinaryData) data).getMimeType(), ((BinaryData) data).getData()); } else { final String value = type.valueToString(data, EdmLiteralKind.DEFAULT, null); response = EntityProvider.writeText(value == null ? "" : value); } return ODataResponse.fromResponse(response).build(); }
value = type == EdmSimpleTypeKind.Binary.getEdmSimpleTypeInstance() ? ((BinaryData) data).getData() : data; } else if (functionImport.getReturnType().getMultiplicity() == EdmMultiplicity.MANY) {
value = type == EdmSimpleTypeKind.Binary.getEdmSimpleTypeInstance() ? ((BinaryData) data).getData() : data; } else if (functionImport.getReturnType().getMultiplicity() == EdmMultiplicity.MANY) {
if (type == EdmSimpleTypeKind.Binary.getEdmSimpleTypeInstance()) { return readBinary(content); } else {
if (type == EdmSimpleTypeKind.Binary.getEdmSimpleTypeInstance()) { return readBinary(content); } else {
&& (node.getEdmType() != EdmSimpleTypeKind.Boolean.getEdmSimpleTypeInstance())) {