use of io.protostuff.compiler.model.ScalarFieldType in project java-chassis by ServiceComb.
the class DeserializerSchemaManager method createRepeatedSchema.
@Override
protected <T> FieldSchema<T> createRepeatedSchema(Field protoField, PropertyDescriptor propertyDescriptor) {
boolean packed = ProtoUtils.isPacked(protoField);
if (protoField.getType().isEnum()) {
return packed ? EnumPackedReadSchemas.create(protoField, propertyDescriptor) : EnumNotPackedReadSchemas.create(protoField, propertyDescriptor);
}
if (protoField.getType().isScalar()) {
switch((ScalarFieldType) protoField.getType()) {
case INT32:
return packed ? Int32PackedReadSchemas.create(protoField, propertyDescriptor) : Int32NotPackedReadSchemas.create(protoField, propertyDescriptor);
case UINT32:
return packed ? UInt32PackedReadSchemas.create(protoField, propertyDescriptor) : UInt32NotPackedReadSchemas.create(protoField, propertyDescriptor);
case SINT32:
return packed ? SInt32PackedReadSchemas.create(protoField, propertyDescriptor) : SInt32NotPackedReadSchemas.create(protoField, propertyDescriptor);
case FIXED32:
return packed ? Fixed32PackedReadSchemas.create(protoField, propertyDescriptor) : Fixed32NotPackedReadSchemas.create(protoField, propertyDescriptor);
case SFIXED32:
return packed ? SFixed32PackedReadSchemas.create(protoField, propertyDescriptor) : SFixed32NotPackedReadSchemas.create(protoField, propertyDescriptor);
case INT64:
return packed ? Int64PackedReadSchemas.create(protoField, propertyDescriptor) : Int64NotPackedReadSchemas.create(protoField, propertyDescriptor);
case UINT64:
return packed ? UInt64PackedReadSchemas.create(protoField, propertyDescriptor) : UInt64NotPackedReadSchemas.create(protoField, propertyDescriptor);
case SINT64:
return packed ? SInt64PackedReadSchemas.create(protoField, propertyDescriptor) : SInt64NotPackedReadSchemas.create(protoField, propertyDescriptor);
case FIXED64:
return packed ? Fixed64PackedReadSchemas.create(protoField, propertyDescriptor) : Fixed64NotPackedReadSchemas.create(protoField, propertyDescriptor);
case SFIXED64:
return packed ? SFixed64PackedReadSchemas.create(protoField, propertyDescriptor) : SFixed64NotPackedReadSchemas.create(protoField, propertyDescriptor);
case FLOAT:
return packed ? FloatPackedReadSchemas.create(protoField, propertyDescriptor) : FloatNotPackedReadSchemas.create(protoField, propertyDescriptor);
case DOUBLE:
return packed ? DoublePackedReadSchemas.create(protoField, propertyDescriptor) : DoubleNotPackedReadSchemas.create(protoField, propertyDescriptor);
case BOOL:
return packed ? BoolPackedReadSchemas.create(protoField, propertyDescriptor) : BoolNotPackedReadSchemas.create(protoField, propertyDescriptor);
case STRING:
return StringRepeatedReadSchemas.create(protoField, propertyDescriptor);
case BYTES:
return BytesRepeatedReadSchemas.create(protoField, propertyDescriptor);
}
}
if (ProtoUtils.isAnyField(protoField)) {
AnyEntrySchema anyEntrySchema = new AnyEntrySchema(protoMapper, null);
return AnyRepeatedReadSchemas.create(protoField, propertyDescriptor, anyEntrySchema);
}
if (protoField.getType().isMessage()) {
JavaType contentType = propertyDescriptor.getJavaType().getContentType();
if (contentType == null) {
contentType = ProtoConst.OBJECT_TYPE;
}
SchemaEx<Object> contentSchema = getOrCreateMessageSchema((Message) protoField.getType(), contentType);
if (isWrapProperty((Message) protoField.getType())) {
return PropertyWrapperRepeatedReadSchemas.create(protoField, propertyDescriptor, contentSchema);
}
return MessageRepeatedReadSchemas.create(protoField, propertyDescriptor, contentSchema);
}
ProtoUtils.throwNotSupportMerge(protoField, propertyDescriptor.getJavaType());
return null;
}
use of io.protostuff.compiler.model.ScalarFieldType in project incubator-servicecomb-java-chassis by apache.
the class SerializerSchemaManager method createRepeatedSchema.
@Override
protected <T> FieldSchema<T> createRepeatedSchema(Field protoField, PropertyDescriptor propertyDescriptor) {
boolean packed = ProtoUtils.isPacked(protoField);
if (protoField.getType().isEnum()) {
return packed ? EnumPackedWriteSchemas.create(protoField, propertyDescriptor) : EnumNotPackedWriteSchemas.create(protoField, propertyDescriptor);
}
if (protoField.getType().isScalar()) {
switch((ScalarFieldType) protoField.getType()) {
case INT32:
return packed ? Int32PackedWriteSchemas.create(protoField, propertyDescriptor) : Int32NotPackedWriteSchemas.create(protoField, propertyDescriptor);
case UINT32:
return packed ? UInt32PackedWriteSchemas.create(protoField, propertyDescriptor) : UInt32NotPackedWriteSchemas.create(protoField, propertyDescriptor);
case SINT32:
return packed ? SInt32PackedWriteSchemas.create(protoField, propertyDescriptor) : SInt32NotPackedWriteSchemas.create(protoField, propertyDescriptor);
case FIXED32:
return packed ? Fixed32PackedWriteSchemas.create(protoField, propertyDescriptor) : Fixed32NotPackedWriteSchemas.create(protoField, propertyDescriptor);
case SFIXED32:
return packed ? SFixed32PackedWriteSchemas.create(protoField, propertyDescriptor) : SFixed32NotPackedWriteSchemas.create(protoField, propertyDescriptor);
case INT64:
return packed ? Int64PackedWriteSchemas.create(protoField, propertyDescriptor) : Int64NotPackedWriteSchemas.create(protoField, propertyDescriptor);
case UINT64:
return packed ? UInt64PackedWriteSchemas.create(protoField, propertyDescriptor) : UInt64NotPackedWriteSchemas.create(protoField, propertyDescriptor);
case SINT64:
return packed ? SInt64PackedWriteSchemas.create(protoField, propertyDescriptor) : SInt64NotPackedWriteSchemas.create(protoField, propertyDescriptor);
case FIXED64:
return packed ? Fixed64PackedWriteSchemas.create(protoField, propertyDescriptor) : Fixed64NotPackedWriteSchemas.create(protoField, propertyDescriptor);
case SFIXED64:
return packed ? SFixed64PackedWriteSchemas.create(protoField, propertyDescriptor) : SFixed64NotPackedWriteSchemas.create(protoField, propertyDescriptor);
case FLOAT:
return packed ? FloatPackedWriteSchemas.create(protoField, propertyDescriptor) : FloatNotPackedWriteSchemas.create(protoField, propertyDescriptor);
case DOUBLE:
return packed ? DoublePackedWriteSchemas.create(protoField, propertyDescriptor) : DoubleNotPackedWriteSchemas.create(protoField, propertyDescriptor);
case BOOL:
return packed ? BoolPackedWriteSchemas.create(protoField, propertyDescriptor) : BoolNotPackedWriteSchemas.create(protoField, propertyDescriptor);
case STRING:
return StringsRepeatedWriteSchemas.create(protoField, propertyDescriptor);
case BYTES:
return BytesRepeatedWriteSchemas.create(protoField, propertyDescriptor);
}
}
if (ProtoUtils.isAnyField(protoField)) {
FieldSchema<T> anySchema = new AnySchema<>(protoMapper, protoField, propertyDescriptor);
return AnyRepeatedWriteSchemas.create(protoField, propertyDescriptor, anySchema);
}
if (protoField.getType().isMessage()) {
JavaType contentType = propertyDescriptor.getJavaType().getContentType();
if (contentType == null) {
contentType = ProtoConst.OBJECT_TYPE;
}
SchemaEx<Object> contentSchema = getOrCreateMessageSchema((Message) protoField.getType(), contentType);
if (isWrapProperty((Message) protoField.getType())) {
return PropertyWrapperRepeatedWriteSchemas.create(protoField, propertyDescriptor, contentSchema);
}
return MessagesRepeatedWriteSchemas.create(protoField, propertyDescriptor, contentSchema);
}
ProtoUtils.throwNotSupportWrite(protoField, propertyDescriptor.getJavaType().getRawClass());
return null;
}
use of io.protostuff.compiler.model.ScalarFieldType in project java-chassis by ServiceComb.
the class SerializerSchemaManager method createRepeatedSchema.
@Override
protected <T> FieldSchema<T> createRepeatedSchema(Field protoField, PropertyDescriptor propertyDescriptor) {
boolean packed = ProtoUtils.isPacked(protoField);
if (protoField.getType().isEnum()) {
return packed ? EnumPackedWriteSchemas.create(protoField, propertyDescriptor) : EnumNotPackedWriteSchemas.create(protoField, propertyDescriptor);
}
if (protoField.getType().isScalar()) {
switch((ScalarFieldType) protoField.getType()) {
case INT32:
return packed ? Int32PackedWriteSchemas.create(protoField, propertyDescriptor) : Int32NotPackedWriteSchemas.create(protoField, propertyDescriptor);
case UINT32:
return packed ? UInt32PackedWriteSchemas.create(protoField, propertyDescriptor) : UInt32NotPackedWriteSchemas.create(protoField, propertyDescriptor);
case SINT32:
return packed ? SInt32PackedWriteSchemas.create(protoField, propertyDescriptor) : SInt32NotPackedWriteSchemas.create(protoField, propertyDescriptor);
case FIXED32:
return packed ? Fixed32PackedWriteSchemas.create(protoField, propertyDescriptor) : Fixed32NotPackedWriteSchemas.create(protoField, propertyDescriptor);
case SFIXED32:
return packed ? SFixed32PackedWriteSchemas.create(protoField, propertyDescriptor) : SFixed32NotPackedWriteSchemas.create(protoField, propertyDescriptor);
case INT64:
return packed ? Int64PackedWriteSchemas.create(protoField, propertyDescriptor) : Int64NotPackedWriteSchemas.create(protoField, propertyDescriptor);
case UINT64:
return packed ? UInt64PackedWriteSchemas.create(protoField, propertyDescriptor) : UInt64NotPackedWriteSchemas.create(protoField, propertyDescriptor);
case SINT64:
return packed ? SInt64PackedWriteSchemas.create(protoField, propertyDescriptor) : SInt64NotPackedWriteSchemas.create(protoField, propertyDescriptor);
case FIXED64:
return packed ? Fixed64PackedWriteSchemas.create(protoField, propertyDescriptor) : Fixed64NotPackedWriteSchemas.create(protoField, propertyDescriptor);
case SFIXED64:
return packed ? SFixed64PackedWriteSchemas.create(protoField, propertyDescriptor) : SFixed64NotPackedWriteSchemas.create(protoField, propertyDescriptor);
case FLOAT:
return packed ? FloatPackedWriteSchemas.create(protoField, propertyDescriptor) : FloatNotPackedWriteSchemas.create(protoField, propertyDescriptor);
case DOUBLE:
return packed ? DoublePackedWriteSchemas.create(protoField, propertyDescriptor) : DoubleNotPackedWriteSchemas.create(protoField, propertyDescriptor);
case BOOL:
return packed ? BoolPackedWriteSchemas.create(protoField, propertyDescriptor) : BoolNotPackedWriteSchemas.create(protoField, propertyDescriptor);
case STRING:
return StringsRepeatedWriteSchemas.create(protoField, propertyDescriptor);
case BYTES:
return BytesRepeatedWriteSchemas.create(protoField, propertyDescriptor);
}
}
if (ProtoUtils.isAnyField(protoField)) {
FieldSchema<T> anySchema = new AnySchema<>(protoMapper, protoField, propertyDescriptor);
return AnyRepeatedWriteSchemas.create(protoField, propertyDescriptor, anySchema);
}
if (protoField.getType().isMessage()) {
JavaType contentType = propertyDescriptor.getJavaType().getContentType();
if (contentType == null) {
contentType = ProtoConst.OBJECT_TYPE;
}
SchemaEx<Object> contentSchema = getOrCreateMessageSchema((Message) protoField.getType(), contentType);
if (isWrapProperty((Message) protoField.getType())) {
return PropertyWrapperRepeatedWriteSchemas.create(protoField, propertyDescriptor, contentSchema);
}
return MessagesRepeatedWriteSchemas.create(protoField, propertyDescriptor, contentSchema);
}
ProtoUtils.throwNotSupportWrite(protoField, propertyDescriptor.getJavaType().getRawClass());
return null;
}
use of io.protostuff.compiler.model.ScalarFieldType in project incubator-servicecomb-java-chassis by apache.
the class DeserializerSchemaManager method createRepeatedSchema.
@Override
protected <T> FieldSchema<T> createRepeatedSchema(Field protoField, PropertyDescriptor propertyDescriptor) {
boolean packed = ProtoUtils.isPacked(protoField);
if (protoField.getType().isEnum()) {
return packed ? EnumPackedReadSchemas.create(protoField, propertyDescriptor) : EnumNotPackedReadSchemas.create(protoField, propertyDescriptor);
}
if (protoField.getType().isScalar()) {
switch((ScalarFieldType) protoField.getType()) {
case INT32:
return packed ? Int32PackedReadSchemas.create(protoField, propertyDescriptor) : Int32NotPackedReadSchemas.create(protoField, propertyDescriptor);
case UINT32:
return packed ? UInt32PackedReadSchemas.create(protoField, propertyDescriptor) : UInt32NotPackedReadSchemas.create(protoField, propertyDescriptor);
case SINT32:
return packed ? SInt32PackedReadSchemas.create(protoField, propertyDescriptor) : SInt32NotPackedReadSchemas.create(protoField, propertyDescriptor);
case FIXED32:
return packed ? Fixed32PackedReadSchemas.create(protoField, propertyDescriptor) : Fixed32NotPackedReadSchemas.create(protoField, propertyDescriptor);
case SFIXED32:
return packed ? SFixed32PackedReadSchemas.create(protoField, propertyDescriptor) : SFixed32NotPackedReadSchemas.create(protoField, propertyDescriptor);
case INT64:
return packed ? Int64PackedReadSchemas.create(protoField, propertyDescriptor) : Int64NotPackedReadSchemas.create(protoField, propertyDescriptor);
case UINT64:
return packed ? UInt64PackedReadSchemas.create(protoField, propertyDescriptor) : UInt64NotPackedReadSchemas.create(protoField, propertyDescriptor);
case SINT64:
return packed ? SInt64PackedReadSchemas.create(protoField, propertyDescriptor) : SInt64NotPackedReadSchemas.create(protoField, propertyDescriptor);
case FIXED64:
return packed ? Fixed64PackedReadSchemas.create(protoField, propertyDescriptor) : Fixed64NotPackedReadSchemas.create(protoField, propertyDescriptor);
case SFIXED64:
return packed ? SFixed64PackedReadSchemas.create(protoField, propertyDescriptor) : SFixed64NotPackedReadSchemas.create(protoField, propertyDescriptor);
case FLOAT:
return packed ? FloatPackedReadSchemas.create(protoField, propertyDescriptor) : FloatNotPackedReadSchemas.create(protoField, propertyDescriptor);
case DOUBLE:
return packed ? DoublePackedReadSchemas.create(protoField, propertyDescriptor) : DoubleNotPackedReadSchemas.create(protoField, propertyDescriptor);
case BOOL:
return packed ? BoolPackedReadSchemas.create(protoField, propertyDescriptor) : BoolNotPackedReadSchemas.create(protoField, propertyDescriptor);
case STRING:
return StringRepeatedReadSchemas.create(protoField, propertyDescriptor);
case BYTES:
return BytesRepeatedReadSchemas.create(protoField, propertyDescriptor);
}
}
if (ProtoUtils.isAnyField(protoField)) {
AnyEntrySchema anyEntrySchema = new AnyEntrySchema(protoMapper, null);
return AnyRepeatedReadSchemas.create(protoField, propertyDescriptor, anyEntrySchema);
}
if (protoField.getType().isMessage()) {
JavaType contentType = propertyDescriptor.getJavaType().getContentType();
if (contentType == null) {
contentType = ProtoConst.OBJECT_TYPE;
}
SchemaEx<Object> contentSchema = getOrCreateMessageSchema((Message) protoField.getType(), contentType);
if (isWrapProperty((Message) protoField.getType())) {
return PropertyWrapperRepeatedReadSchemas.create(protoField, propertyDescriptor, contentSchema);
}
return MessageRepeatedReadSchemas.create(protoField, propertyDescriptor, contentSchema);
}
ProtoUtils.throwNotSupportMerge(protoField, propertyDescriptor.getJavaType());
return null;
}
Aggregations