@Override public boolean isPrimitive() { return propertyType != null && propertyType.getKind() == EdmTypeKind.PRIMITIVE; }
@Override public boolean isPrimitive() { return propertyType != null && propertyType.getKind() == EdmTypeKind.PRIMITIVE; }
private boolean isEnumType(final Expression expression) throws UriParserException { final EdmType expressionType = getType(expression); return expressionType == null || expressionType.getKind() == EdmTypeKind.ENUM || isType(expressionType, EdmPrimitiveTypeKind.Int16, EdmPrimitiveTypeKind.Int32, EdmPrimitiveTypeKind.Int64, EdmPrimitiveTypeKind.Byte, EdmPrimitiveTypeKind.SByte); }
private boolean isEnumType(final Expression expression) throws UriParserException { final EdmType expressionType = getType(expression); return expressionType == null || expressionType.getKind() == EdmTypeKind.ENUM || isType(expressionType, EdmPrimitiveTypeKind.Int16, EdmPrimitiveTypeKind.Int32, EdmPrimitiveTypeKind.Int64, EdmPrimitiveTypeKind.Byte, EdmPrimitiveTypeKind.SByte); }
@Override public BuilderImpl setType(final EdmType type) { EdmPrimitiveTypeKind primitiveTypeKind = null; if (type != null) { if (type.getKind() != EdmTypeKind.PRIMITIVE) { throw new IllegalArgumentException(String.format("Provided type %s is not primitive", type)); } primitiveTypeKind = EdmPrimitiveTypeKind.valueOf(type.getName()); } return setType(primitiveTypeKind); }
@Override public BuilderImpl setType(final EdmType type) { EdmPrimitiveTypeKind primitiveTypeKind = null; if (type != null) { if (type.getKind() != EdmTypeKind.PRIMITIVE) { throw new IllegalArgumentException(String.format("Provided type %s is not primitive", type)); } primitiveTypeKind = EdmPrimitiveTypeKind.valueOf(type.getName()); } return setType(primitiveTypeKind); }
public boolean isReturnTypePrimitive() { return getReturnType().getType().getKind() == EdmTypeKind.PRIMITIVE; }
public boolean isReturnTypeComplex() { return getReturnType().getType().getKind() == EdmTypeKind.COMPLEX; }
public boolean isReturnTypePrimitive() { return getReturnType().getType().getKind() == EdmTypeKind.PRIMITIVE; }
public boolean isReturnTypeComplex() { return getReturnType().getType().getKind() == EdmTypeKind.COMPLEX; }
@SuppressWarnings("unchecked") private <RES extends ClientInvokeResult> Class<RES> getResultReference(final EdmReturnType returnType) { Class<RES> result; if (returnType == null) { result = (Class<RES>) ClientNoContent.class; } else { if (returnType.isCollection() && returnType.getType().getKind() == EdmTypeKind.ENTITY) { result = (Class<RES>) ClientEntitySet.class; } else if (!returnType.isCollection() && returnType.getType().getKind() == EdmTypeKind.ENTITY) { result = (Class<RES>) ClientEntity.class; } else { result = (Class<RES>) ClientProperty.class; } } return result; }
@SuppressWarnings("unchecked") private <RES extends ClientInvokeResult> Class<RES> getResultReference(final EdmReturnType returnType) { Class<RES> result; if (returnType == null) { result = (Class<RES>) ClientNoContent.class; } else { if (returnType.isCollection() && returnType.getType().getKind() == EdmTypeKind.ENTITY) { result = (Class<RES>) ClientEntitySet.class; } else if (!returnType.isCollection() && returnType.getType().getKind() == EdmTypeKind.ENTITY) { result = (Class<RES>) ClientEntity.class; } else { result = (Class<RES>) ClientProperty.class; } } return result; }
@SuppressWarnings("unchecked") protected <RES extends ClientInvokeResult> Class<RES> getResultReference(final EdmReturnType returnType) { Class<RES> result; if (returnType == null) { result = (Class<RES>) ClientNoContent.class; } else { if (returnType.isCollection() && returnType.getType().getKind() == EdmTypeKind.ENTITY) { result = (Class<RES>) ClientEntitySet.class; } else if (!returnType.isCollection() && returnType.getType().getKind() == EdmTypeKind.ENTITY) { result = (Class<RES>) ClientEntity.class; } else { result = (Class<RES>) ClientProperty.class; } } return result; } }
@SuppressWarnings("unchecked") protected <RES extends ClientInvokeResult> Class<RES> getResultReference(final EdmReturnType returnType) { Class<RES> result; if (returnType == null) { result = (Class<RES>) ClientNoContent.class; } else { if (returnType.isCollection() && returnType.getType().getKind() == EdmTypeKind.ENTITY) { result = (Class<RES>) ClientEntitySet.class; } else if (!returnType.isCollection() && returnType.getType().getKind() == EdmTypeKind.ENTITY) { result = (Class<RES>) ClientEntity.class; } else { result = (Class<RES>) ClientProperty.class; } } return result; } }
private void handleValueDispatching(final ODataRequest request, final ODataResponse response, final int lastPathSegmentIndex) throws ODataApplicationException, ODataLibraryException { // The URI Parser already checked if $value is allowed here so we only have to dispatch to the correct processor final UriResource resource = uriInfo.getUriResourceParts().get(lastPathSegmentIndex - 1); if (resource instanceof UriResourceProperty || resource instanceof UriResourceFunction && ((UriResourceFunction) resource).getType().getKind() == EdmTypeKind.PRIMITIVE) { handlePrimitiveValueDispatching(request, response, resource); } else { handleMediaValueDispatching(request, response, resource); } }
private EdmTypeKind determineReturnEdmTypeKind(final UriResourcePartTyped operation) { if (operation instanceof UriResourceFunction) return ((UriResourceFunction) operation).getFunction().getReturnType().getType().getKind(); else return ((UriResourceAction) operation).getAction().getReturnType().getType().getKind(); }
private void handleValueDispatching(final ODataRequest request, final ODataResponse response, final int lastPathSegmentIndex) throws ODataApplicationException, ODataLibraryException { // The URI Parser already checked if $value is allowed here so we only have to dispatch to the correct processor final UriResource resource = uriInfo.getUriResourceParts().get(lastPathSegmentIndex - 1); if (resource instanceof UriResourceProperty || resource instanceof UriResourceFunction && ((UriResourceFunction) resource).getType().getKind() == EdmTypeKind.PRIMITIVE) { handlePrimitiveValueDispatching(request, response, resource); } else { handleMediaValueDispatching(request, response, resource); } }
private void appendOperationParameters(final XMLStreamWriter writer, final EdmOperation operation) throws XMLStreamException { for (String parameterName : operation.getParameterNames()) { EdmParameter parameter = operation.getParameter(parameterName); writer.writeStartElement(XML_PARAMETER); writer.writeAttribute(XML_NAME, parameterName); String typeFqnString; if (EdmTypeKind.PRIMITIVE.equals(parameter.getType().getKind())) { typeFqnString = getFullQualifiedName(parameter.getType(), parameter.isCollection()); } else { typeFqnString = getAliasedFullQualifiedName(parameter.getType(), parameter.isCollection()); } writer.writeAttribute(XML_TYPE, typeFqnString); appendParameterFacets(writer, parameter); appendAnnotations(writer, parameter); writer.writeEndElement(); } }
private void appendOperationReturnType(final XMLStreamWriter writer, final EdmOperation operation) throws XMLStreamException { EdmReturnType returnType = operation.getReturnType(); if (returnType != null) { writer.writeEmptyElement(XML_RETURN_TYPE); String returnTypeFqnString; if (EdmTypeKind.PRIMITIVE.equals(returnType.getType().getKind())) { returnTypeFqnString = getFullQualifiedName(returnType.getType(), returnType.isCollection()); } else { returnTypeFqnString = getAliasedFullQualifiedName(returnType.getType(), returnType.isCollection()); } writer.writeAttribute(XML_TYPE, returnTypeFqnString); appendReturnTypeFacets(writer, returnType); } }
private void appendOperationReturnType(final XMLStreamWriter writer, final EdmOperation operation) throws XMLStreamException { EdmReturnType returnType = operation.getReturnType(); if (returnType != null) { writer.writeEmptyElement(XML_RETURN_TYPE); String returnTypeFqnString; if (EdmTypeKind.PRIMITIVE.equals(returnType.getType().getKind())) { returnTypeFqnString = getFullQualifiedName(returnType.getType(), returnType.isCollection()); } else { returnTypeFqnString = getAliasedFullQualifiedName(returnType.getType(), returnType.isCollection()); } writer.writeAttribute(XML_TYPE, returnTypeFqnString); appendReturnTypeFacets(writer, returnType); } }