本文整理了Java中io.protostuff.Output.writeEnum()
方法的一些代码示例,展示了Output.writeEnum()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Output.writeEnum()
方法的具体详情如下:
包路径:io.protostuff.Output
类名称:Output
方法名:writeEnum
[英]Writes a enum(its number) field.
[中]写入枚举(其编号)字段。
代码示例来源:origin: protostuff/protostuff
@Override
public void writeEnum(int fieldNumber, int value, boolean repeated) throws IOException
{
output.writeEnum(fieldNumber, value, repeated);
}
代码示例来源:origin: protostuff/protostuff
/**
* Transfers the {@link Enum} from the input to the output.
*/
public static void transfer(Pipe pipe, Input input, Output output,
int number, boolean repeated, IdStrategy strategy) throws IOException
{
if (0 == (IdStrategy.ENUMS_BY_NAME & strategy.flags))
output.writeEnum(number, input.readEnum(), repeated);
else
input.transferByteRangeTo(output, true, number, repeated);
}
代码示例来源:origin: protostuff/protostuff
/**
* Transfers the {@link Enum} from the input to the output.
*/
public static void transfer(Pipe pipe, Input input, Output output,
int number, boolean repeated, IdStrategy strategy) throws IOException
{
if (0 == (IdStrategy.ENUMS_BY_NAME & strategy.flags))
output.writeEnum(number, input.readEnum(), repeated);
else
input.transferByteRangeTo(output, true, number, repeated);
}
代码示例来源:origin: protostuff/protostuff
/**
* Writes the {@link Enum} to the output.
*/
public void writeTo(Output output, int number, boolean repeated,
Enum<?> e) throws IOException
{
if (0 == (IdStrategy.ENUMS_BY_NAME & strategy.flags))
output.writeEnum(number, getTag(e), repeated);
else
output.writeString(number, getAlias(e), repeated);
}
代码示例来源:origin: protostuff/protostuff
/**
* Writes the {@link Enum} to the output.
*/
public void writeTo(Output output, int number, boolean repeated,
Enum<?> e) throws IOException
{
if (0 == (IdStrategy.ENUMS_BY_NAME & strategy.flags))
output.writeEnum(number, getTag(e), repeated);
else
output.writeString(number, getAlias(e), repeated);
}
代码示例来源:origin: protostuff/protostuff
@Test
public void testWriteNumericEnum() throws Exception
{
RuntimeSchema<A> schema = RuntimeSchema.createFrom(A.class);
A a = new A(TaggedEnum.TEN);
Output output = Mockito.mock(Output.class);
schema.writeTo(output, a);
Mockito.verify(output).writeEnum(1, 10, false);
Mockito.verifyNoMoreInteractions(output);
}
代码示例来源:origin: protostuff/protostuff
@Override
public void writeTo(Output output, Bar message) throws IOException
{
if (message.someInt != 0)
output.writeInt32(1, message.someInt, false);
if (message.someString != null)
output.writeString(2, message.someString, false);
if (message.someBaz != null)
output.writeObject(3, message.someBaz, Baz.getSchema(), false);
if (message.someEnum != null)
output.writeEnum(4, message.someEnum.number, false);
if (message.someBytes != null)
output.writeBytes(5, message.someBytes, false);
if (message.someBoolean)
output.writeBool(6, message.someBoolean, false);
if (message.someFloat != 0f)
output.writeFloat(7, message.someFloat, false);
if (message.someDouble != 0d)
output.writeDouble(8, message.someDouble, false);
if (message.someLong != 0l)
output.writeInt64(9, message.someLong, false);
}
代码示例来源:origin: protostuff/protostuff
output.writeEnum(4, value.number, true);
代码示例来源:origin: dremio/dremio-oss
public void writeTo(Output output, FieldConvertNumberToDate message) throws IOException
{
if(message.format == null)
throw new UninitializedMessageException(message);
output.writeEnum(1, message.format.number, false);
if(message.desiredType != null)
output.writeEnum(2, message.desiredType.number, false);
if(message.convertType != null)
output.writeEnum(3, message.convertType.number, false);
}
代码示例来源:origin: dremio/dremio-oss
public void writeTo(Output output, FieldReplaceCustom message) throws IOException
{
if(message.booleanExpression == null)
throw new UninitializedMessageException(message);
output.writeString(1, message.booleanExpression, false);
if(message.replaceType != null)
output.writeEnum(2, message.replaceType.number, false);
if(message.replacementValue != null)
output.writeString(3, message.replacementValue, false);
if(message.replacementType != null)
output.writeEnum(4, message.replacementType.number, false);
}
代码示例来源:origin: dremio/dremio-oss
public void writeTo(Output output, FieldConvertToTypeWithPatternIfPossible message) throws IOException
{
if(message.desiredType == null)
throw new UninitializedMessageException(message);
output.writeEnum(1, message.desiredType.number, false);
if(message.pattern == null)
throw new UninitializedMessageException(message);
output.writeString(2, message.pattern, false);
if(message.actionForNonMatchingValue == null)
throw new UninitializedMessageException(message);
output.writeEnum(3, message.actionForNonMatchingValue.number, false);
}
代码示例来源:origin: dremio/dremio-oss
public void writeTo(Output output, LayoutDimensionFieldDescriptor message) throws IOException
{
if(message.name == null)
throw new UninitializedMessageException(message);
output.writeString(1, message.name, false);
if(message.granularity != null && message.granularity != DEFAULT_GRANULARITY)
output.writeEnum(2, message.granularity.number, false);
}
代码示例来源:origin: dremio/dremio-oss
public void writeTo(Output output, FilterCleanData message) throws IOException
{
if(message.desiredType == null)
throw new UninitializedMessageException(message);
output.writeEnum(1, message.desiredType.number, false);
if(message.castWhenPossible == null)
throw new UninitializedMessageException(message);
output.writeBool(2, message.castWhenPossible, false);
}
代码示例来源:origin: dremio/dremio-oss
public void writeTo(io.protostuff.Output output, com.dremio.exec.proto.CoordExecRPC.FragmentPriority message) throws java.io.IOException
{
if(message.hasWorkloadClass())
output.writeEnum(1, message.getWorkloadClass().getNumber(), false);
}
public boolean isInitialized(com.dremio.exec.proto.CoordExecRPC.FragmentPriority message)
代码示例来源:origin: dremio/dremio-oss
public void writeTo(Output output, FilterConvertibleDataWithPattern message) throws IOException
{
if(message.desiredType == null)
throw new UninitializedMessageException(message);
output.writeEnum(1, message.desiredType.number, false);
if(message.pattern == null)
throw new UninitializedMessageException(message);
output.writeString(2, message.pattern, false);
}
代码示例来源:origin: dremio/dremio-oss
public void writeTo(io.protostuff.Output output, com.dremio.exec.proto.UserProtos.QueryPriority message) throws java.io.IOException
{
if(message.hasWorkloadClass())
output.writeEnum(1, message.getWorkloadClass().getNumber(), false);
if(message.hasWorkloadType())
output.writeEnum(2, message.getWorkloadType().getNumber(), false);
}
public boolean isInitialized(com.dremio.exec.proto.UserProtos.QueryPriority message)
代码示例来源:origin: dremio/dremio-oss
public void writeTo(Output output, LayoutDimensionField message) throws IOException
{
if(message.name == null)
throw new UninitializedMessageException(message);
output.writeString(1, message.name, false);
if(message.typeFamily == null)
throw new UninitializedMessageException(message);
output.writeString(2, message.typeFamily, false);
if(message.granularity != null && message.granularity != DEFAULT_GRANULARITY)
output.writeEnum(3, message.granularity.number, false);
}
代码示例来源:origin: dremio/dremio-oss
public void writeTo(Output output, Field message) throws IOException
{
if(message.name == null)
throw new UninitializedMessageException(message);
output.writeString(1, message.name, false);
if(message.type == null)
throw new UninitializedMessageException(message);
output.writeEnum(2, message.type.number, false);
if(message.typeFamily == null)
throw new UninitializedMessageException(message);
output.writeString(3, message.typeFamily, false);
}
代码示例来源:origin: dremio/dremio-oss
public void writeTo(Output output, AccelerationRequest message) throws IOException
{
if(message.username == null)
throw new UninitializedMessageException(message);
output.writeString(1, message.username, false);
if(message.createdAt != null)
output.writeUInt64(2, message.createdAt, false);
if(message.type != null)
output.writeEnum(3, message.type.number, false);
if(message.context != null)
output.writeObject(4, message.context, AccelerationRequestContext.getSchema(), false);
}
代码示例来源:origin: dremio/dremio-oss
public void writeTo(io.protostuff.Output output, com.dremio.exec.proto.UserProtos.GetQueryPlanFragments message) throws java.io.IOException
{
if(message.hasQuery())
output.writeString(1, message.getQuery(), false);
if(message.hasType())
output.writeEnum(2, message.getType().getNumber(), false);
if(message.hasSplitPlan())
output.writeBool(3, message.getSplitPlan(), false);
}
public boolean isInitialized(com.dremio.exec.proto.UserProtos.GetQueryPlanFragments message)
内容来源于网络,如有侵权,请联系作者删除!