private void appendReturnTypeFacets(final XMLStreamWriter writer, final EdmReturnType returnType) throws XMLStreamException { if (!returnType.isNullable()) { writer.writeAttribute(XML_NULLABLE, "" + returnType.isNullable()); } if (returnType.getMaxLength() != null) { writer.writeAttribute(XML_MAX_LENGTH, "" + returnType.getMaxLength()); } if (returnType.getPrecision() != null) { writer.writeAttribute(XML_PRECISION, "" + returnType.getPrecision()); } if (returnType.getScale() != null) { writer.writeAttribute(XML_SCALE, "" + returnType.getScale()); } }
private void appendReturnTypeFacets(final XMLStreamWriter writer, final EdmReturnType returnType) throws XMLStreamException { if (!returnType.isNullable()) { writer.writeAttribute(XML_NULLABLE, "" + returnType.isNullable()); } if (returnType.getMaxLength() != null) { writer.writeAttribute(XML_MAX_LENGTH, "" + returnType.getMaxLength()); } if (returnType.getPrecision() != null) { writer.writeAttribute(XML_PRECISION, "" + returnType.getPrecision()); } if (returnType.getScale() != null) { writer.writeAttribute(XML_SCALE, "" + returnType.getScale()); } }
private void appendReturnTypeFacets(final JsonGenerator json, final EdmReturnType returnType) throws SerializerException, IOException { if (!returnType.isNullable()) { json.writeBooleanField(NULLABLE, returnType.isNullable()); } if (returnType.getMaxLength() != null) { json.writeNumberField(MAX_LENGTH, returnType.getMaxLength()); } if (returnType.getPrecision() != null) { json.writeNumberField(PRECISION, returnType.getPrecision()); } if (returnType.getScale() != null) { json.writeNumberField(SCALE, returnType.getScale()); } }
private void appendReturnTypeFacets(final JsonGenerator json, final EdmReturnType returnType) throws SerializerException, IOException { if (!returnType.isNullable()) { json.writeBooleanField(NULLABLE, returnType.isNullable()); } if (returnType.getMaxLength() != null) { json.writeNumberField(MAX_LENGTH, returnType.getMaxLength()); } if (returnType.getPrecision() != null) { json.writeNumberField(PRECISION, returnType.getPrecision()); } if (returnType.getScale() != null) { json.writeNumberField(SCALE, returnType.getScale()); } }
@Override public void setReturnValue(Object returnValue) throws SQLException { try { EdmReturnType returnType = this.procedureReturn.getReturnType(); this.returnValue = EntityCollectionResponse.buildPropery("return", //$NON-NLS-1$ (SingletonPrimitiveType) returnType.getType(), returnType.getPrecision(), returnType.getScale(), returnType.isCollection(), returnValue); } catch (TeiidProcessingException e) { throw new SQLException(e); } catch (IOException e) { throw new SQLException(e); } }
@SuppressWarnings("unchecked") @Override public <T> T getSerializerOptions(Class<T> serilizerOptions, ContextURL contextUrl, boolean references) throws ContentNegotiatorException { if (serilizerOptions.isAssignableFrom(PrimitiveSerializerOptions.class)) { return (T) PrimitiveSerializerOptions.with().contextURL(contextUrl) .nullable(getReturnType().isNullable()) .maxLength(getReturnType().getMaxLength()) .precision(getReturnType().getPrecision()) .scale(getReturnType().getScale()) .unicode(null) .build(); } return super.getSerializerOptions(serilizerOptions, contextUrl, references); }
@SuppressWarnings("unchecked") @Override public <T> T getSerializerOptions(Class<T> serilizerOptions, ContextURL contextUrl, boolean references) throws ContentNegotiatorException { if (serilizerOptions.isAssignableFrom(PrimitiveSerializerOptions.class)) { return (T) PrimitiveSerializerOptions.with().contextURL(contextUrl) .nullable(getReturnType().isNullable()) .maxLength(getReturnType().getMaxLength()) .precision(getReturnType().getPrecision()) .scale(getReturnType().getScale()) .unicode(null) .build(); } return super.getSerializerOptions(serilizerOptions, contextUrl, references); }
@SuppressWarnings("unchecked") @Override public <T> T getSerializerOptions(Class<T> serilizerOptions, ContextURL contextUrl, boolean references) throws ContentNegotiatorException { if (hasReturnType() && serilizerOptions.isAssignableFrom(PrimitiveSerializerOptions.class)) { return (T) PrimitiveSerializerOptions.with().contextURL(contextUrl) .nullable(getReturnType().isNullable()) .maxLength(getReturnType().getMaxLength()) .precision(getReturnType().getPrecision()) .scale(getReturnType().getScale()) .unicode(null) .build(); } return super.getSerializerOptions(serilizerOptions, contextUrl, references); }
@SuppressWarnings("unchecked") @Override public <T> T getSerializerOptions(Class<T> serilizerOptions, ContextURL contextUrl, boolean references) throws ContentNegotiatorException { if (hasReturnType() && serilizerOptions.isAssignableFrom(PrimitiveSerializerOptions.class)) { return (T) PrimitiveSerializerOptions.with().contextURL(contextUrl) .nullable(getReturnType().isNullable()) .maxLength(getReturnType().getMaxLength()) .precision(getReturnType().getPrecision()) .scale(getReturnType().getScale()) .unicode(null) .build(); } return super.getSerializerOptions(serilizerOptions, contextUrl, references); }
public void write(Object value) throws SerializerException { if (value == null) { writeNoContent(true); return; } if (this.type != null) { PrimitiveValueSerializerOptions options = PrimitiveValueSerializerOptions.with() .facetsFrom(this.type).build(); this.response.setContent(this.serializer.primitiveValue((EdmPrimitiveType) this.type.getType(), value, options)); } else { PrimitiveValueSerializerOptions options = PrimitiveValueSerializerOptions.with() .nullable(this.returnType.isNullable()).maxLength(this.returnType.getMaxLength()) .precision(this.returnType.getPrecision()).scale(this.returnType.getScale()).build(); this.response.setContent(this.serializer.primitiveValue( (EdmPrimitiveType) this.returnType.getType(), value, options)); } writeOK(ContentType.TEXT_PLAIN); }
public void write(Object value) throws SerializerException { if (value == null) { writeNoContent(true); return; } if (this.type != null) { PrimitiveValueSerializerOptions options = PrimitiveValueSerializerOptions.with() .facetsFrom(this.type).build(); this.response.setContent(this.serializer.primitiveValue((EdmPrimitiveType) this.type.getType(), value, options)); } else { PrimitiveValueSerializerOptions options = PrimitiveValueSerializerOptions.with() .nullable(this.returnType.isNullable()).maxLength(this.returnType.getMaxLength()) .precision(this.returnType.getPrecision()).scale(this.returnType.getScale()).build(); this.response.setContent(this.serializer.primitiveValue( (EdmPrimitiveType) this.returnType.getType(), value, options)); } writeOK(ContentType.TEXT_PLAIN); }