io.protostuff.Schema.getFieldNumber()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中io.protostuff.Schema.getFieldNumber()方法的一些代码示例,展示了Schema.getFieldNumber()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Schema.getFieldNumber()方法的具体详情如下:
包路径:io.protostuff.Schema
类名称:Schema
方法名:getFieldNumber

Schema.getFieldNumber介绍

[英]Gets the field number associated with the name. This is particularly useful when serializing to different formats (Eg. JSON). When using numeric field names:

return Integer.parseInt(name);

[中]获取与名称关联的字段号。这在序列化为不同格式(例如JSON)时特别有用。使用数字字段名时:

return Integer.parseInt(name);

代码示例

代码示例来源:origin: protostuff/protostuff

@Override
public int getFieldNumber(String name)
{
  return wrappedSchema.getFieldNumber(name);
}

代码示例来源:origin: protostuff/protostuff

@Override
public int getFieldNumber(String name)
{
  return schema.getFieldNumber(name);
}

代码示例来源:origin: protostuff/protostuff

int number = numeric ? Integer.parseInt(name) : schema.getFieldNumber(name);

代码示例来源:origin: protostuff/protostuff

@Override
public <T> int readFieldNumber(Schema<T> schema) throws IOException
{
  if (offset == limit)
    return 0;
  final int size = buffer[offset++] | (buffer[offset++] << 8);
  final int number = numeric ? parseInt(buffer, offset, size, 10, true) :
      schema.getFieldNumber(STRING.deser(buffer, offset, size));
  offset += size;
  if (number == 0)
  {
    // skip unknown fields.
    handleUnknownField(number, schema);
    return readFieldNumber(schema);
  }
  return number;
}

代码示例来源:origin: protostuff/protostuff

final int num = schema.getFieldNumber(name);

代码示例来源:origin: protostuff/protostuff

@Override
public <T> int readFieldNumber(Schema<T> schema) throws IOException
{
  if (offset + 2 > limit && !readable(2))
  {
    if (offset != limit)
      throw new ProtostuffException("Truncated message.");
    return 0;
  }
  final int size = buffer[offset++] | (buffer[offset++] << 8);
  if (offset + size > limit && !readable(size))
    throw new ProtostuffException("Truncated message.");
  final int number = numeric ? parseInt(buffer, offset, size, 10, true) :
      schema.getFieldNumber(STRING.deser(buffer, offset, size));
  offset += size;
  if (number == 0)
  {
    // skip unknown fields.
    handleUnknownField(number, schema);
    return readFieldNumber(schema);
  }
  return number;
}

代码示例来源:origin: protostuff/protostuff

fieldNumber = schema.getFieldNumber(name);

代码示例来源:origin: io.protostuff/protostuff-json

int number = numeric ? Integer.parseInt(name) : schema.getFieldNumber(name);

相关文章