io.protostuff.WireFormat Java Examples

The following examples show how to use io.protostuff.WireFormat. 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();
}
 
Example #3
Source File: Field.java    From protostuff with Apache License 2.0 5 votes vote down vote up
public Field(WireFormat.FieldType type, int number, String name, boolean repeated,
        Tag tag)
{
    this.type = type;
    this.number = number;
    this.name = name;
    this.repeated = repeated;
    this.groupFilter = tag == null ? 0 : tag.groupFilter();
    // this.tag = tag;
}
 
Example #4
Source File: TimeDelegate.java    From joyrpc with Apache License 2.0 4 votes vote down vote up
@Override
public WireFormat.FieldType getFieldType() {
    return WireFormat.FieldType.FIXED64;
}
 
Example #5
Source File: SqlDateDelegate.java    From joyrpc with Apache License 2.0 4 votes vote down vote up
@Override
public WireFormat.FieldType getFieldType() {
    return WireFormat.FieldType.FIXED64;
}
 
Example #6
Source File: DateDelegate.java    From tx-lcn with Apache License 2.0 4 votes vote down vote up
@Override
public WireFormat.FieldType getFieldType() {
    return WireFormat.FieldType.FIXED64;
}
 
Example #7
Source File: TimestampDelegate.java    From tx-lcn with Apache License 2.0 4 votes vote down vote up
public WireFormat.FieldType getFieldType() {
    return WireFormat.FieldType.FIXED64;
}
 
Example #8
Source File: Field.java    From protostuff with Apache License 2.0 4 votes vote down vote up
public Field(WireFormat.FieldType type, int number, String name, Tag tag)
{
    this(type, number, name, false, tag);
}
 
Example #9
Source File: AbstractRuntimeObjectSchemaTest.java    From protostuff with Apache License 2.0 4 votes vote down vote up
@Override
public WireFormat.FieldType getFieldType()
{
    return WireFormat.FieldType.MESSAGE;
}
 
Example #10
Source File: AbstractRuntimeObjectSchemaTest.java    From protostuff with Apache License 2.0 4 votes vote down vote up
@Override
public WireFormat.FieldType getFieldType()
{
    return WireFormat.FieldType.MESSAGE;
}