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

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

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

Schema.isInitialized介绍

[英]Returns true if there is no required field or if all the required fields are set.
[中]如果没有必填字段或设置了所有必填字段,则返回true。

代码示例

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

@Override
public boolean isInitialized(T message)
{
  return schema.isInitialized(message);
}

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

@Override
public void mergeFrom(Input input, final Object message) throws IOException
{
  final Schema<Object> schema = lastSchema;
  // merge using this input.
  schema.mergeFrom(this, message);
  if (!schema.isInitialized(message))
    throw new UninitializedMessageException(message, schema);
  // restore
  lastSchema = schema;
}

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

@Override
public void mergeFrom(Input input, final Object message) throws IOException
{
  final Schema<Object> schema = lastSchema;
  // merge using this input.
  schema.mergeFrom(this, message);
  if (!schema.isInitialized(message))
    throw new UninitializedMessageException(message, schema);
  // restore
  lastSchema = schema;
}

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

private <T> T mergeObjectEncodedAsGroup(T value, final Schema<T> schema) throws IOException
{
  if (value == null)
    value = schema.newMessage();
  schema.mergeFrom(this, value);
  if (!schema.isInitialized(value))
    throw new UninitializedMessageException(value, schema);
  // handling is in #readFieldNumber
  checkLastTagWas(0);
  return value;
}

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

private <T> T mergeObjectEncodedAsGroup(T value, final Schema<T> schema) throws IOException
{
  if (value == null)
    value = schema.newMessage();
  schema.mergeFrom(this, value);
  if (!schema.isInitialized(value))
    throw new UninitializedMessageException(value, schema);
  // handling is in #readFieldNumber
  checkLastTagWas(0);
  return value;
}

代码示例来源:origin: fengjiachun/Jupiter

private <T> T mergeObjectEncodedAsGroup(T value, final Schema<T> schema) throws IOException {
  if (value == null) {
    value = schema.newMessage();
  }
  schema.mergeFrom(this, value);
  if (!schema.isInitialized(value)) {
    throw new UninitializedMessageException(value, schema);
  }
  // handling is in #readFieldNumber
  checkLastTagWas(0);
  return value;
}

代码示例来源:origin: fengjiachun/Jupiter

private <T> T mergeObjectEncodedAsGroup(T value, final Schema<T> schema) throws IOException {
  if (value == null) {
    value = schema.newMessage();
  }
  schema.mergeFrom(this, value);
  if (!schema.isInitialized(value)) {
    throw new UninitializedMessageException(value, schema);
  }
  // handling is in #readFieldNumber
  checkLastTagWas(0);
  return value;
}

代码示例来源:origin: fengjiachun/Jupiter

private <T> T mergeObjectEncodedAsGroup(T value, final Schema<T> schema) throws IOException {
  if (value == null) {
    value = schema.newMessage();
  }
  schema.mergeFrom(this, value);
  if (!schema.isInitialized(value)) {
    throw new UninitializedMessageException(value, schema);
  }
  // handling is in #readFieldNumber
  checkLastTagWas(0);
  return value;
}

代码示例来源:origin: fengjiachun/Jupiter

private <T> T mergeObjectEncodedAsGroup(T value, final Schema<T> schema) throws IOException {
  if (value == null) {
    value = schema.newMessage();
  }
  schema.mergeFrom(this, value);
  if (!schema.isInitialized(value)) {
    throw new UninitializedMessageException(value, schema);
  }
  // handling is in #readFieldNumber
  checkLastTagWas(0);
  return value;
}

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

if (!schema.isInitialized(value))
  throw new UninitializedMessageException(value, schema);

代码示例来源:origin: fengjiachun/Jupiter

@Override
public <T> T mergeObject(T value, final Schema<T> schema) throws IOException {
  if (decodeNestedMessageAsGroup) {
    return mergeObjectEncodedAsGroup(value, schema);
  }
  final int length = readRawVarInt32();
  if (length < 0) {
    throw ProtocolException.negativeSize();
  }
  if (nioBuffer.remaining() < length) {
    throw ProtocolException.misreportedSize();
  }
  ByteBuffer dup = nioBuffer.slice();
  dup.limit(length);
  if (value == null) {
    value = schema.newMessage();
  }
  ByteBufferInput nestedInput = new ByteBufferInput(dup, false);
  schema.mergeFrom(nestedInput, value);
  if (!schema.isInitialized(value)) {
    throw new UninitializedMessageException(value, schema);
  }
  nestedInput.checkLastTagWas(0);
  nioBuffer.position(nioBuffer.position() + length);
  return value;
}

代码示例来源:origin: fengjiachun/Jupiter

@Override
public <T> T mergeObject(T value, final Schema<T> schema) throws IOException {
  if (decodeNestedMessageAsGroup) {
    return mergeObjectEncodedAsGroup(value, schema);
  }
  final int length = readRawVarInt32();
  if (length < 0) {
    throw ProtocolException.negativeSize();
  }
  if (nioBuffer.remaining() < length) {
    throw ProtocolException.misreportedSize();
  }
  ByteBuffer dup = nioBuffer.slice();
  dup.limit(length);
  if (value == null) {
    value = schema.newMessage();
  }
  ByteBufferInput nestedInput = new ByteBufferInput(dup, false);
  schema.mergeFrom(nestedInput, value);
  if (!schema.isInitialized(value)) {
    throw new UninitializedMessageException(value, schema);
  }
  nestedInput.checkLastTagWas(0);
  nioBuffer.position(nioBuffer.position() + length);
  return value;
}

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

@Override
public <T> T mergeObject(T value, final Schema<T> schema) throws IOException
{
  if (decodeNestedMessageAsGroup)
    return mergeObjectEncodedAsGroup(value, schema);
  final int length = readRawVarint32();
  if (length < 0)
    throw ProtobufException.negativeSize();
  if (buffer.remaining() < length)
    throw ProtobufException.misreportedSize();
  ByteBuffer dup = buffer.slice();
  dup.limit(length);
  // save old limit
  // final int oldLimit = this.limit;
  // this.limit = offset + length;
  if (value == null)
    value = schema.newMessage();
  ByteBufferInput nestedInput = new ByteBufferInput(dup, decodeNestedMessageAsGroup);
  schema.mergeFrom(nestedInput, value);
  if (!schema.isInitialized(value))
    throw new UninitializedMessageException(value, schema);
  nestedInput.checkLastTagWas(0);
  // checkLastTagWas(0);
  // restore old limit
  // this.limit = oldLimit;
  buffer.position(buffer.position() + length);
  return value;
}

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

@Override
public <T> T mergeObject(T value, final Schema<T> schema) throws IOException
{
  emptyMessage = nextTag() == END_ELEMENT;
  if (value == null)
    value = schema.newMessage();
  schema.mergeFrom(this, value);
  if (!schema.isInitialized(value))
    throw new UninitializedMessageException(value, schema);
  // onto the next
  nextTag();
  return value;
}

代码示例来源:origin: fengjiachun/Jupiter

if (!schema.isInitialized(value)) {
  throw new UninitializedMessageException(value, schema);

代码示例来源:origin: fengjiachun/Jupiter

if (!schema.isInitialized(value)) {
  throw new UninitializedMessageException(value, schema);

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

/**
 * Reads a message field value from the stream (using the {@code group} encoding).
 */
private <T> T mergeObjectEncodedAsGroup(T value, final Schema<T> schema) throws IOException
{
  // if (recursionDepth >= recursionLimit) {
  // throw ProtobufException.recursionLimitExceeded();
  // }
  // ++recursionDepth;
  if (value == null)
  {
    value = schema.newMessage();
  }
  schema.mergeFrom(this, value);
  if (!schema.isInitialized(value))
  {
    throw new UninitializedMessageException(value, schema);
  }
  // handling is in #readFieldNumber
  checkLastTagWas(0);
  // --recursionDepth;
  return value;
}

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

@Override
public <T> T mergeObject(T value, final Schema<T> schema) throws IOException
{
  if (decodeNestedMessageAsGroup)
    return mergeObjectEncodedAsGroup(value, schema);
  final int length = readRawVarint32();
  if (length < 0)
    throw ProtobufException.negativeSize();
  // save old limit
  final int oldLimit = this.limit;
  this.limit = offset + length;
  if (value == null)
    value = schema.newMessage();
  schema.mergeFrom(this, value);
  if (!schema.isInitialized(value))
    throw new UninitializedMessageException(value, schema);
  checkLastTagWas(0);
  // restore old limit
  this.limit = oldLimit;
  return value;
}

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

if (!schema.isInitialized(message))
  throw new UninitializedMessageException(message, schema);

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

@Override
public <T> T mergeObject(T value, final Schema<T> schema) throws IOException
{
  if (decodeNestedMessageAsGroup)
    return mergeObjectEncodedAsGroup(value, schema);
  final int length = readRawVarint32();
  // if (recursionDepth >= recursionLimit) {
  // throw ProtobufException.recursionLimitExceeded();
  // }
  final int oldLimit = pushLimit(length);
  // ++recursionDepth;
  if (value == null)
  {
    value = schema.newMessage();
  }
  schema.mergeFrom(this, value);
  if (!schema.isInitialized(value))
  {
    throw new UninitializedMessageException(value, schema);
  }
  checkLastTagWas(0);
  // --recursionDepth;
  popLimit(oldLimit);
  return value;
}

相关文章