Java中的isEnum_Java Property.isEnum方法代码示例

import org.apache.olingo.commons.api.data.Property; //导入方法依赖的package包/类

/**

* Writes primitive property into json.

*

* @param type

* the EDM type

* @param property

* property instance

* @param options

* options for the serializer

* @param json

* json generator

* @throws EdmPrimitiveTypeException

* if any error occurred

* @throws IOException

* if any error occurred

* @throws SerializerException

* if any error occurred

*/

private void writePrimitive(EdmPrimitiveType type, Property property,

PrimitiveSerializerOptions options, JsonGenerator json)

throws EdmPrimitiveTypeException, IOException, SerializerException {

Boolean isNullable = options == null ? null : options.isNullable();

Integer maxLength = options == null ? null : options.getMaxLength();

Integer precision = options == null ? null : options.getPrecision();

Integer scale = options == null ? null : options.getScale();

Boolean isUnicode = options == null ? null : options.isUnicode();

if (property.isPrimitive()) {

writePrimitiveValue(property.getName(), type, property.asPrimitive(), isNullable,

maxLength, precision, scale, isUnicode, json);

} else if (property.isGeospatial()) {

throw new SerializerException("Property type not yet supported!",

SerializerException.MessageKeys.UNSUPPORTED_PROPERTY_TYPE, property.getName());

} else if (property.isEnum()) {

writePrimitiveValue(property.getName(), type, property.asEnum(), isNullable, maxLength,

precision, scale, isUnicode, json);

} else {

throw new SerializerException("Inconsistent property type!",

SerializerException.MessageKeys.INCONSISTENT_PROPERTY_TYPE, property.getName());

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值