io.protostuff.WireFormat.FieldType Java Examples
The following examples show how to use
io.protostuff.WireFormat.FieldType.
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: CodedOutputTest.java From protostuff with Apache License 2.0 | 6 votes |
public void testRawLittleEndian64Bytes() throws Exception { String n1 = "double1", n2 = "double2"; for (int i = 0; i < doubleValues.length;) { double[] inner = doubleValues[i++]; int num = i; for (int j = 0; j < inner.length; j++) { long value = Double.doubleToRawLongBits(inner[j]); int tag = WireFormat.makeTag(num, FieldType.DOUBLE.wireType); int tagSize = CodedOutput.computeRawVarint32Size(tag); int expect = tagSize + CodedOutput.LITTLE_ENDIAN_64_SIZE; assertSize(n1, CodedOutput.computeDoubleSize(num, inner[j]), expect); assertSize(n2, CodedOutput.getTagAndRawLittleEndian64Bytes(tag, value).length, expect); } } }
Example #2
Source File: CodedOutputTest.java From protostuff with Apache License 2.0 | 6 votes |
public void testRawLittleEndian32Bytes() throws Exception { String n1 = "float1", n2 = "float2"; for (int i = 0; i < floatValues.length;) { float[] inner = floatValues[i++]; int num = i; for (int j = 0; j < inner.length; j++) { int value = Float.floatToRawIntBits(inner[j]); int valueSize = CodedOutput.LITTLE_ENDIAN_32_SIZE; int tag = WireFormat.makeTag(num, FieldType.FLOAT.wireType); int tagSize = CodedOutput.computeRawVarint32Size(tag); int expect = tagSize + valueSize; assertSize(n1, CodedOutput.computeFloatSize(num, inner[j]), expect); assertSize(n2, CodedOutput.getTagAndRawLittleEndian32Bytes(tag, value).length, expect); } } }
Example #3
Source File: CodedOutputTest.java From protostuff with Apache License 2.0 | 6 votes |
public void testRawVarInt64Bytes() throws Exception { String n1 = "long1", n2 = "long2"; for (int i = 0; i < int64values.length;) { long[] inner = int64values[i++]; int num = i; for (int j = 0; j < inner.length; j++) { long value = inner[j]; int valueSize = CodedOutput.computeRawVarint64Size(value); int tag = WireFormat.makeTag(num, FieldType.INT64.wireType); int tagSize = CodedOutput.computeRawVarint32Size(tag); int expect = tagSize + valueSize; assertSize(n1, CodedOutput.computeInt64Size(num, value), expect); assertSize(n2, CodedOutput.getTagAndRawVarInt64Bytes(tag, value).length, expect); } } }
Example #4
Source File: CodedOutputTest.java From protostuff with Apache License 2.0 | 6 votes |
public void testRawVarInt32Bytes() throws Exception { String n1 = "int1", n2 = "int2"; for (int i = 0; i < int32values.length;) { int[] inner = int32values[i++]; int num = i; for (int j = 0; j < inner.length; j++) { int value = inner[j]; int valueSize = CodedOutput.computeRawVarint32Size(value); int tag = WireFormat.makeTag(num, FieldType.INT32.wireType); int tagSize = CodedOutput.computeRawVarint32Size(tag); int expect = tagSize + valueSize; assertSize(n1, CodedOutput.computeInt32Size(num, value), expect); assertSize(n2, CodedOutput.getTagAndRawVarInt32Bytes(tag, value).length, expect); } } }
Example #5
Source File: RuntimeDerivativeField.java From protostuff with Apache License 2.0 | 6 votes |
public RuntimeDerivativeField(Class<Object> typeClass, FieldType type, int number, String name, boolean repeated, Tag tag, IdStrategy strategy) { super(type, number, name, repeated, tag); this.typeClass = typeClass; schema = new DerivativeSchema(strategy) { @Override protected void doMergeFrom(Input input, Schema<Object> derivedSchema, Object owner) throws IOException { RuntimeDerivativeField.this.doMergeFrom(input, derivedSchema, owner); } }; }
Example #6
Source File: RuntimeCollectionField.java From protostuff with Apache License 2.0 | 5 votes |
public RuntimeCollectionField(FieldType type, int number, String name, Tag tag, MessageFactory messageFactory, boolean allowNullElement) { super(type, number, name, false, tag); schema = new CollectionSchema<V>(messageFactory, allowNullElement) { @Override protected void addValueFrom(Input input, Collection<V> collection) throws IOException { RuntimeCollectionField.this.addValueFrom(input, collection); } @Override protected void writeValueTo(Output output, int fieldNumber, V value, boolean repeated) throws IOException { RuntimeCollectionField.this.writeValueTo(output, fieldNumber, value, repeated); } @Override protected void transferValue(Pipe pipe, Input input, Output output, int number, boolean repeated) throws IOException { RuntimeCollectionField.this.transferValue(pipe, input, output, number, repeated); } }; }
Example #7
Source File: RuntimeMessageField.java From protostuff with Apache License 2.0 | 5 votes |
public RuntimeMessageField(Class<P> typeClass, HasSchema<P> hasSchema, FieldType type, int number, String name, boolean repeated, Tag tag) { super(type, number, name, repeated, tag); this.typeClass = typeClass; this.hasSchema = hasSchema; }
Example #8
Source File: RuntimeObjectField.java From protostuff with Apache License 2.0 | 5 votes |
public RuntimeObjectField(Class<?> typeClass, FieldType type, int number, String name, boolean repeated, Tag tag, PolymorphicSchema.Factory factory, IdStrategy strategy) { super(type, number, name, repeated, tag); schema = factory.newSchema(typeClass, strategy, this); }
Example #9
Source File: CodedOutputTest.java From protostuff with Apache License 2.0 | 5 votes |
public void testBool() throws Exception { int num = 1; boolean value = true; int valueSize = 1; int tag = WireFormat.makeTag(num, FieldType.BOOL.wireType); int tagSize = CodedOutput.computeRawVarint32Size(tag); int expect = tagSize + valueSize; assertSize("boolean1", CodedOutput.computeBoolSize(num, value), expect); assertSize("boolean2", CodedOutput.getTagAndRawVarInt32Bytes(tag, 1).length, expect); }
Example #10
Source File: RuntimeReflectionFieldFactory.java From protostuff with Apache License 2.0 | 4 votes |
@Override public FieldType getFieldType() { return FieldType.DOUBLE; }
Example #11
Source File: RuntimeReflectionFieldFactory.java From protostuff with Apache License 2.0 | 4 votes |
@Override public FieldType getFieldType() { return FieldType.FLOAT; }
Example #12
Source File: RuntimeReflectionFieldFactory.java From protostuff with Apache License 2.0 | 4 votes |
@Override public FieldType getFieldType() { return FieldType.INT64; }
Example #13
Source File: RuntimeReflectionFieldFactory.java From protostuff with Apache License 2.0 | 4 votes |
@Override public FieldType getFieldType() { return FieldType.INT32; }
Example #14
Source File: RuntimeReflectionFieldFactory.java From protostuff with Apache License 2.0 | 4 votes |
@Override public FieldType getFieldType() { return FieldType.BOOL; }
Example #15
Source File: RuntimeReflectionFieldFactory.java From protostuff with Apache License 2.0 | 4 votes |
@Override public FieldType getFieldType() { return FieldType.STRING; }
Example #16
Source File: RuntimeReflectionFieldFactory.java From protostuff with Apache License 2.0 | 4 votes |
@Override public FieldType getFieldType() { return FieldType.BYTES; }
Example #17
Source File: RuntimeReflectionFieldFactory.java From protostuff with Apache License 2.0 | 4 votes |
@Override public FieldType getFieldType() { return FieldType.BYTES; }
Example #18
Source File: RuntimeReflectionFieldFactory.java From protostuff with Apache License 2.0 | 4 votes |
@Override public FieldType getFieldType() { throw new UnsupportedOperationException(); }
Example #19
Source File: RuntimeReflectionFieldFactory.java From protostuff with Apache License 2.0 | 4 votes |
@Override public FieldType getFieldType() { throw new UnsupportedOperationException(); }
Example #20
Source File: RuntimeReflectionFieldFactory.java From protostuff with Apache License 2.0 | 4 votes |
@Override public FieldType getFieldType() { throw new UnsupportedOperationException(); }
Example #21
Source File: RuntimeReflectionFieldFactory.java From protostuff with Apache License 2.0 | 4 votes |
@Override public FieldType getFieldType() { return FieldType.MESSAGE; }
Example #22
Source File: RuntimeReflectionFieldFactory.java From protostuff with Apache License 2.0 | 4 votes |
@Override public FieldType getFieldType() { return FieldType.STRING; }
Example #23
Source File: RuntimeReflectionFieldFactory.java From protostuff with Apache License 2.0 | 4 votes |
@Override public FieldType getFieldType() { return FieldType.BYTES; }
Example #24
Source File: RuntimeReflectionFieldFactory.java From protostuff with Apache License 2.0 | 4 votes |
@Override public FieldType getFieldType() { return FieldType.FIXED64; }
Example #25
Source File: RuntimeReflectionFieldFactory.java From protostuff with Apache License 2.0 | 4 votes |
@Override public FieldType getFieldType() { throw new UnsupportedOperationException(); }
Example #26
Source File: RuntimeFieldFactory.java From protostuff with Apache License 2.0 | 4 votes |
@Override public FieldType getFieldType() { throw new UnsupportedOperationException(); }
Example #27
Source File: RuntimeCollectionFieldFactory.java From protostuff with Apache License 2.0 | 4 votes |
@Override public FieldType getFieldType() { throw new UnsupportedOperationException(); }
Example #28
Source File: SampleDelegates.java From protostuff with Apache License 2.0 | 4 votes |
@Override public FieldType getFieldType() { return FieldType.BYTES; }
Example #29
Source File: SampleDelegates.java From protostuff with Apache License 2.0 | 4 votes |
@Override public FieldType getFieldType() { return FieldType.UINT32; }
Example #30
Source File: RuntimeFieldFactory.java From protostuff with Apache License 2.0 | 4 votes |
@Override public FieldType getFieldType() { throw new UnsupportedOperationException(); }