@Override public EdmPrimitiveType createPrimitiveTypeInstance(final EdmPrimitiveTypeKind kind) { return EdmPrimitiveTypeFactory.getInstance(kind); }
@Override public EdmType getType() { return EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean); }
@Override public EdmType getType() { return EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean); }
@Override public EdmType getType() { return EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean); }
@Override public EdmType getType() { return EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean); }
@Override public EdmPrimitiveType createPrimitiveTypeInstance(final EdmPrimitiveTypeKind kind) { return EdmPrimitiveTypeFactory.getInstance(kind); }
@Override public BuilderImpl setType(final EdmPrimitiveTypeKind type) { if (type == EdmPrimitiveTypeKind.Stream) { throw new IllegalArgumentException(String.format( "Cannot build a primitive value for %s", EdmPrimitiveTypeKind.Stream.toString())); } if (type == EdmPrimitiveTypeKind.Geography || type == EdmPrimitiveTypeKind.Geometry) { throw new IllegalArgumentException( type + "is not an instantiable type. " + "An entity can declare a property to be of type Geometry. " + "An instance of an entity MUST NOT have a value of type Geometry. " + "Each value MUST be of some subtype."); } instance.typeKind = type == null ? EdmPrimitiveTypeKind.String : type; instance.type = EdmPrimitiveTypeFactory.getInstance(instance.typeKind); return this; }
@Override public BuilderImpl setType(final EdmPrimitiveTypeKind type) { if (type == EdmPrimitiveTypeKind.Stream) { throw new IllegalArgumentException(String.format( "Cannot build a primitive value for %s", EdmPrimitiveTypeKind.Stream.toString())); } if (type == EdmPrimitiveTypeKind.Geography || type == EdmPrimitiveTypeKind.Geometry) { throw new IllegalArgumentException( type + "is not an instantiable type. " + "An entity can declare a property to be of type Geometry. " + "An instance of an entity MUST NOT have a value of type Geometry. " + "Each value MUST be of some subtype."); } instance.typeKind = type == null ? EdmPrimitiveTypeKind.String : type; instance.type = EdmPrimitiveTypeFactory.getInstance(instance.typeKind); return this; }
private boolean isStreamProperty(EdmProperty edmProperty) { final EdmType type = edmProperty.getType(); return (edmProperty.isPrimitive() && type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Stream)); }
private boolean isStreamProperty(EdmProperty edmProperty) { final EdmType type = edmProperty.getType(); return (edmProperty.isPrimitive() && type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Stream)); }
private boolean isStreamProperty(EdmProperty edmProperty) { final EdmType type = edmProperty.getType(); return (edmProperty.isPrimitive() && type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Stream)); }
private boolean isStreamProperty(EdmProperty edmProperty) { final EdmType type = edmProperty.getType(); return (edmProperty.isPrimitive() && type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Stream)); }
private boolean isStreamProperty(EdmProperty edmProperty) { final EdmType type = edmProperty.getType(); return (edmProperty.isPrimitive() && type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Stream)); }
private boolean isStreamProperty(EdmProperty edmProperty) { final EdmType type = edmProperty.getType(); return (edmProperty.isPrimitive() && type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Stream)); }
public EdmEnumTypeImpl(final Edm edm, final FullQualifiedName enumName, final CsdlEnumType enumType) { super(edm, enumName, EdmTypeKind.ENUM, enumType); if (enumType.getUnderlyingType() == null) { underlyingType = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32); } else { final EdmPrimitiveTypeKind underlyingTypeKind = EdmPrimitiveTypeKind.valueOfFQN(enumType.getUnderlyingType()); if (underlyingTypeKind == EdmPrimitiveTypeKind.Byte || underlyingTypeKind == EdmPrimitiveTypeKind.SByte || underlyingTypeKind == EdmPrimitiveTypeKind.Int16 || underlyingTypeKind == EdmPrimitiveTypeKind.Int32 || underlyingTypeKind == EdmPrimitiveTypeKind.Int64) { underlyingType = EdmPrimitiveTypeFactory.getInstance(underlyingTypeKind); } else { throw new EdmException("Not allowed as underlying type: " + underlyingTypeKind); } } this.enumType = enumType; this.enumName = enumName; }
public EdmEnumTypeImpl(final Edm edm, final FullQualifiedName enumName, final CsdlEnumType enumType) { super(edm, enumName, EdmTypeKind.ENUM, enumType); if (enumType.getUnderlyingType() == null) { underlyingType = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32); } else { final EdmPrimitiveTypeKind underlyingTypeKind = EdmPrimitiveTypeKind.valueOfFQN(enumType.getUnderlyingType()); if (underlyingTypeKind == EdmPrimitiveTypeKind.Byte || underlyingTypeKind == EdmPrimitiveTypeKind.SByte || underlyingTypeKind == EdmPrimitiveTypeKind.Int16 || underlyingTypeKind == EdmPrimitiveTypeKind.Int32 || underlyingTypeKind == EdmPrimitiveTypeKind.Int64) { underlyingType = EdmPrimitiveTypeFactory.getInstance(underlyingTypeKind); } else { throw new EdmException("Not allowed as underlying type: " + underlyingTypeKind); } } this.enumType = enumType; this.enumName = enumName; }
protected void primitiveValue(final JsonGenerator jgen, final EdmTypeInfo typeInfo, final Object value) throws IOException, EdmPrimitiveTypeException { final EdmPrimitiveTypeKind kind = typeInfo == null ? EdmTypeInfo.determineTypeKind(value) : typeInfo.getPrimitiveTypeKind(); if (value == null) { jgen.writeNull(); } else if (kind == EdmPrimitiveTypeKind.Boolean) { jgen.writeBoolean((Boolean) value); } else if (kind == null) { if (serverMode) { throw new EdmPrimitiveTypeException("The primitive type could not be determined."); } else { jgen.writeString(value.toString()); // This might not be valid OData. } } else { // TODO: add facets final String serialized = EdmPrimitiveTypeFactory.getInstance(kind) .valueToString(value, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null); if (isIEEE754Compatible && (kind == EdmPrimitiveTypeKind.Int64 || kind == EdmPrimitiveTypeKind.Decimal) || !NUMBER_TYPES.contains(kind)) { jgen.writeString(serialized); } else { jgen.writeNumber(serialized); } } }
protected void primitiveValue(final JsonGenerator jgen, final EdmTypeInfo typeInfo, final Object value) throws IOException, EdmPrimitiveTypeException { final EdmPrimitiveTypeKind kind = typeInfo == null ? EdmTypeInfo.determineTypeKind(value) : typeInfo.getPrimitiveTypeKind(); if (value == null) { jgen.writeNull(); } else if (kind == EdmPrimitiveTypeKind.Boolean) { jgen.writeBoolean((Boolean) value); } else if (kind == null) { if (serverMode) { throw new EdmPrimitiveTypeException("The primitive type could not be determined."); } else { jgen.writeString(value.toString()); // This might not be valid OData. } } else { // TODO: add facets final String serialized = EdmPrimitiveTypeFactory.getInstance(kind) .valueToString(value, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null); if (isIEEE754Compatible && (kind == EdmPrimitiveTypeKind.Int64 || kind == EdmPrimitiveTypeKind.Decimal) || !NUMBER_TYPES.contains(kind)) { jgen.writeString(serialized); } else { jgen.writeNumber(serialized); } } }
public static Object parseLiteral(String odataType, String value) throws TeiidException { EdmPrimitiveType primitiveType = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind .valueOf(odataType.substring(4)));
String value = EdmPrimitiveTypeFactory.getInstance(kind).valueToString( propertyValue, property.isNullable(), property.getMaxLength(), property.getPrecision(), property.getScale(), property.isUnicode());