Java Code Examples for io.protostuff.WireFormat#makeTag()

The following examples show how to use io.protostuff.WireFormat#makeTag() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractWriters.java    From servicecomb-java-chassis with Apache License 2.0 5 votes vote down vote up
public AbstractWriters(Field protoField, Class<T[]> arrayClass) {
  this.protoField = protoField;
  int wireType = ProtoUtils.isPacked(protoField) && protoField.isRepeated() ? WireFormat.WIRETYPE_LENGTH_DELIMITED
      : FieldTypeUtils.convert(protoField.getType()).wireType;
  this.tag = WireFormat.makeTag(protoField.getTag(), wireType);
  this.tagSize = ProtobufOutputEx.computeRawVarint32Size(tag);

  if (arrayClass == null) {
    arrayClass = getFieldArgument(this.getClass(), "arrayWriter");
  }
  this.arrayClass = arrayClass;
}
 
Example 2
Source File: FieldSchema.java    From servicecomb-java-chassis with Apache License 2.0 5 votes vote down vote up
public FieldSchema(Field protoField, JavaType javaType) {
  this.protoField = protoField;
  this.name = protoField.getName();
  this.fieldNumber = protoField.getTag();
  this.packed = ProtoUtils.isPacked(protoField);

  int wireType = packed && protoField.isRepeated() ? WireFormat.WIRETYPE_LENGTH_DELIMITED
      : FieldTypeUtils.convert(protoField.getType()).wireType;
  this.tag = WireFormat.makeTag(fieldNumber, wireType);
  this.tagSize = ProtobufOutputEx.computeRawVarint32Size(tag);

  this.javaType = javaType;
  this.primitive = javaType.isPrimitive();
}