本文整理了Java中io.protostuff.Schema.getFieldName()
方法的一些代码示例,展示了Schema.getFieldName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Schema.getFieldName()
方法的具体详情如下:
包路径:io.protostuff.Schema
类名称:Schema
方法名:getFieldName
[英]Gets the field name associated with the number. This is particularly useful when serializing to different formats (Eg. JSON). When using numeric field names:
return String.valueOf(number);
[中]获取与数字关联的字段名。这在序列化为不同格式(例如JSON)时特别有用。使用数字字段名时:
return String.valueOf(number);
代码示例来源:origin: protostuff/protostuff
@Override
public void writeInt64(int fieldNumber, long value, boolean repeated) throws IOException
{
write(writer, schema.getFieldName(fieldNumber), Long.toString(value));
}
代码示例来源:origin: protostuff/protostuff
@Override
public void writeString(int fieldNumber, CharSequence value, boolean repeated) throws IOException
{
write(writer, schema.getFieldName(fieldNumber), value.toString());
}
代码示例来源:origin: protostuff/protostuff
@Override
public void writeByteArray(int fieldNumber, byte[] value, boolean repeated) throws IOException
{
writeB64(schema.getFieldName(fieldNumber), value, 0, value.length, repeated);
}
代码示例来源:origin: protostuff/protostuff
@Override
public void writeInt32(int fieldNumber, int value, boolean repeated) throws IOException
{
write(writer, schema.getFieldName(fieldNumber), Integer.toString(value));
}
代码示例来源:origin: protostuff/protostuff
@Override
public void writeSInt64(int fieldNumber, long value, boolean repeated) throws IOException
{
write(writer, schema.getFieldName(fieldNumber), Long.toString(value));
}
代码示例来源:origin: protostuff/protostuff
@Override
public void writeFloat(int fieldNumber, float value, boolean repeated) throws IOException
{
write(writer, schema.getFieldName(fieldNumber), Float.toString(value));
}
代码示例来源:origin: protostuff/protostuff
@Override
public void writeFixed32(int fieldNumber, int value, boolean repeated) throws IOException
{
write(writer, schema.getFieldName(fieldNumber), Integer.toString(value));
}
代码示例来源:origin: protostuff/protostuff
@Override
public void writeSFixed32(int fieldNumber, int value, boolean repeated) throws IOException
{
write(writer, schema.getFieldName(fieldNumber), Integer.toString(value));
}
代码示例来源:origin: protostuff/protostuff
@Override
public void writeUInt64(int fieldNumber, long value, boolean repeated) throws IOException
{
write(writer, schema.getFieldName(fieldNumber), Long.toString(value));
}
代码示例来源:origin: protostuff/protostuff
@Override
public void writeDouble(int fieldNumber, double value, boolean repeated) throws IOException
{
write(writer, schema.getFieldName(fieldNumber), Double.toString(value));
}
代码示例来源:origin: protostuff/protostuff
@Override
public void writeBool(int fieldNumber, boolean value, boolean repeated) throws IOException
{
write(writer, schema.getFieldName(fieldNumber), String.valueOf(value));
}
代码示例来源:origin: protostuff/protostuff
@Override
public void writeEnum(int fieldNumber, int value, boolean repeated) throws IOException
{
write(writer, schema.getFieldName(fieldNumber), Integer.toString(value));
}
代码示例来源:origin: protostuff/protostuff
@Override
public void writeFixed64(int fieldNumber, long value, boolean repeated) throws IOException
{
write(writer, schema.getFieldName(fieldNumber), Long.toString(value));
}
代码示例来源:origin: protostuff/protostuff
@Override
public void writeSFixed64(int fieldNumber, long value, boolean repeated) throws IOException
{
write(writer, schema.getFieldName(fieldNumber), Long.toString(value));
}
代码示例来源:origin: protostuff/protostuff
@Override
public void writeByteArray(int fieldNumber, byte[] value, boolean repeated) throws IOException
{
writeB64Encoded(writer, schema.getFieldName(fieldNumber),
value.length == 0 ? EMPTY : B64Code.cencode(value));
}
代码示例来源:origin: protostuff/protostuff
@Override
public void writeInt32(int fieldNumber, int value, boolean repeated) throws IOException
{
final String name = schema.getFieldName(fieldNumber);
tail = sink.writeByte(END_TAG, this,
sink.writeStrAscii(name, this,
sink.writeByteArray(START_SLASH_TAG, this,
sink.writeStrFromInt(value, this,
sink.writeByte(END_TAG, this,
sink.writeStrAscii(name, this,
sink.writeByte(START_TAG, this, tail)))))));
}
代码示例来源:origin: protostuff/protostuff
@Override
public void writeInt64(int fieldNumber, long value, boolean repeated) throws IOException
{
final String name = schema.getFieldName(fieldNumber);
tail = sink.writeByte(END_TAG, this,
sink.writeStrAscii(name, this,
sink.writeByteArray(START_SLASH_TAG, this,
sink.writeStrFromLong(value, this,
sink.writeByte(END_TAG, this,
sink.writeStrAscii(name, this,
sink.writeByte(START_TAG, this, tail)))))));
}
代码示例来源:origin: protostuff/protostuff
@Override
public void writeFloat(int fieldNumber, float value, boolean repeated) throws IOException
{
final String name = schema.getFieldName(fieldNumber);
tail = sink.writeByte(END_TAG, this,
sink.writeStrAscii(name, this,
sink.writeByteArray(START_SLASH_TAG, this,
sink.writeStrFromFloat(value, this,
sink.writeByte(END_TAG, this,
sink.writeStrAscii(name, this,
sink.writeByte(START_TAG, this, tail)))))));
}
代码示例来源:origin: protostuff/protostuff
@Override
public void writeDouble(int fieldNumber, double value, boolean repeated) throws IOException
{
final String name = schema.getFieldName(fieldNumber);
tail = sink.writeByte(END_TAG, this,
sink.writeStrAscii(name, this,
sink.writeByteArray(START_SLASH_TAG, this,
sink.writeStrFromDouble(value, this,
sink.writeByte(END_TAG, this,
sink.writeStrAscii(name, this,
sink.writeByte(START_TAG, this, tail)))))));
}
代码示例来源:origin: protostuff/protostuff
@Override
public void writeString(int fieldNumber, CharSequence value, boolean repeated) throws IOException
{
final String name = schema.getFieldName(fieldNumber);
tail = sink.writeByte(END_TAG, this,
sink.writeStrAscii(name, this,
sink.writeByteArray(START_SLASH_TAG, this,
sink.writeStrUTF8(value, this,
sink.writeByte(END_TAG, this,
sink.writeStrAscii(name, this,
sink.writeByte(START_TAG, this, tail)))))));
}
内容来源于网络,如有侵权,请联系作者删除!