Examples of newBuilderForType()


Examples of com.google.protobuf.Message.newBuilderForType()

              .getReturnProtoType(ProtobufRpcEngine.Server.getMethod(protocol,
                  param.getMethodName()));
        } catch (Exception e) {
          throw new RuntimeException(e); // local exception
        }
        Builder builder = rpcResponseType.newBuilderForType();
        builder.mergeDelimitedFrom(in);
        Message value = builder.build();

        return value;
      } else if (status == Status.ERROR) {
View Full Code Here

Examples of com.google.protobuf.Message.newBuilderForType()

            String typeName = buffer.toString(buffer.readerIndex(), nameLen - 1,
                    Charset.defaultCharset());
            buffer.readerIndex(buffer.readerIndex() + nameLen);
            Message prototype = knownTypes.get(typeName);
            if (prototype != null) {
                return prototype.newBuilderForType().mergeFrom(buffer.array(),
                        buffer.arrayOffset() + buffer.readerIndex(),
                        buffer.readableBytes() - 4).build();
            }
        }
        return obj;
View Full Code Here

Examples of com.google.protobuf.Message.newBuilderForType()

     * @see org.apache.camel.spi.DataFormat#unmarshal(org.apache.camel.Exchange,
     * java.io.InputStream)
     */
    public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception {
        Message instance = getInstance(exchange);
        Builder builder = instance.newBuilderForType().mergeFrom(inputStream);
        if (!builder.isInitialized()) {
            // TODO which exception should be thrown here?
            throw new InvalidPayloadException(exchange, instance.getClass());
        }

View Full Code Here

Examples of com.google.protobuf.Message.newBuilderForType()

     * @see org.apache.camel.spi.DataFormat#unmarshal(org.apache.camel.Exchange,
     * java.io.InputStream)
     */
    public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception {
        Message instance = getInstance(exchange);
        Builder builder = instance.newBuilderForType().mergeFrom(inputStream);
        if (!builder.isInitialized()) {
            // TODO which exception should be thrown here?
            throw new InvalidPayloadException(exchange, instance.getClass());
        }

View Full Code Here

Examples of com.google.protobuf.Message.newBuilderForType()

          method = methodCache.getMethod(this.protocol, header.getMethodName());
          Message m = methodCache.getMethodArgType(method);
          // Check that there is a param to deserialize.
          if (m != null) {
            Builder builder = null;
            builder = m.newBuilderForType();
            // To read the varint, I need an inputstream; might as well be a CIS.
            cis = CodedInputStream.newInstance(buf, offset, buf.length);
            int paramSize = cis.readRawVarint32();
            offset += cis.getTotalBytesRead();
            if (builder != null) {
View Full Code Here

Examples of com.google.protobuf.Message.newBuilderForType()

     * @see org.apache.camel.spi.DataFormat#unmarshal(org.apache.camel.Exchange,
     * java.io.InputStream)
     */
    public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception {
        Message instance = getInstance(exchange);
        Builder builder = instance.newBuilderForType().mergeFrom(inputStream);
        if (!builder.isInitialized()) {
            // TODO which exception should be thrown here?
            throw new InvalidPayloadException(exchange, instance.getClass());
        }

View Full Code Here

Examples of com.google.protobuf.Message.newBuilderForType()

          Message msg = messages.get(type);
          if(null == msg) {
            msg = (Message)type.getMethod("getDefaultInstance").invoke(null);
            messages.put(type, msg);
          }
          IN obj = (IN)msg.newBuilderForType().mergeFrom(bytes).build();
          if(null != next) {
            next.accept(obj);
            return null;
          } else {
            return obj;
View Full Code Here

Examples of com.google.protobuf.Message.newBuilderForType()

            String typeName = buffer.toString(buffer.readerIndex(), nameLen - 1,
                    Charset.defaultCharset());
            buffer.readerIndex(buffer.readerIndex() + nameLen);
            Message prototype = knownTypes.get(typeName);
            if (prototype != null) {
                return prototype.newBuilderForType().mergeFrom(buffer.array(),
                        buffer.arrayOffset() + buffer.readerIndex(),
                        buffer.readableBytes() - 4).build();
            }
        }
        return obj;
View Full Code Here

Examples of java.util.List.newBuilderForType()

        Message existingValue = (Message)fields.get(field);
        if (existingValue == null) {
          setField(field, entry.getValue());
        } else {
          setField(field,
            existingValue.newBuilderForType()
              .mergeFrom(existingValue)
              .mergeFrom((Message)entry.getValue())
              .build());
        }
      } else {
View Full Code Here

Examples of java.util.List.newBuilderForType()

        Message existingValue = (Message)fields.get(field);
        if (existingValue == null) {
          setField(field, value);
        } else {
          setField(field,
            existingValue.newBuilderForType()
              .mergeFrom(existingValue)
              .mergeFrom((Message)value)
              .build());
        }
      } else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.