if (fieldType.isScalar()) { switch ((ScalarFieldType) fieldType) { case INT32:
/** * all supported type, default to packed * @param protoField * @return */ public static boolean isSupportPacked(Field protoField) { if (protoField.getType().isEnum()) { return true; } if (protoField.getType().isScalar()) { ScalarFieldType scalarFieldType = (ScalarFieldType) protoField.getType(); return scalarFieldType != ScalarFieldType.STRING && scalarFieldType != ScalarFieldType.BYTES; } return false; }
public <T> FieldSchema<T> createSchemaField(Field protoField, PropertyDescriptor propertyDescriptor) { // map is a special repeated if (protoField.isMap()) { return createMapFieldSchema(protoField, propertyDescriptor); } if (protoField.isRepeated()) { return createRepeatedSchema(protoField, propertyDescriptor); } if (isAnyField(protoField)) { return new AnySchema<>(protoMapper, protoField, propertyDescriptor); } if (protoField.getType().isScalar()) { return createScalarField(protoField, propertyDescriptor); } // message if (protoField.getType().isMessage()) { SchemaEx<Object> messageSchema = getOrCreateMessageSchema((Message) protoField.getType(), propertyDescriptor.getJavaType()); if (isWrapProperty((Message) protoField.getType())) { return new PropertyWrapperAsFieldSchema<>(protoField, propertyDescriptor, messageSchema); } return new MessageAsFieldSchema<>(protoField, propertyDescriptor, messageSchema); } if (protoField.isOneofPart()) { throw new IllegalStateException("not IMPL oneof now."); } ProtoUtils.throwNotSupportWrite(protoField, propertyDescriptor.getJavaType().getRawClass()); return null; }
if (fieldType.isScalar()) { switch ((ScalarFieldType) fieldType) { case INT32:
static BeanFactory createFactory(Field field) { // map also is repeated, so must determine first if (field.isMap()) { return BeanFactory::mapFactory; } if (field.isRepeated()) { return BeanFactory::listFactory; } if (field.getType().isScalar()) { // no need a factory return null; } return BeanFactory::mapFactory; }
if (protoField.getType().isScalar()) { switch ((ScalarFieldType) protoField.getType()) { case INT32:
if (protoField.getType().isScalar()) { switch ((ScalarFieldType) protoField.getType()) { case INT32:
if (protoField.getType().isScalar()) { return createScalarField(protoField);
if (protoField.getType().isScalar()) { return createScalarField(protoField);