当前位置: 首页>>代码示例>>Java>>正文


Java GeneratedMessage.Builder方法代码示例

本文整理汇总了Java中com.google.protobuf.GeneratedMessage.Builder方法的典型用法代码示例。如果您正苦于以下问题:Java GeneratedMessage.Builder方法的具体用法?Java GeneratedMessage.Builder怎么用?Java GeneratedMessage.Builder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.protobuf.GeneratedMessage的用法示例。


在下文中一共展示了GeneratedMessage.Builder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newCall

import com.google.protobuf.GeneratedMessage; //导入方法依赖的package包/类
private Call newCall(GeneratedMessage.Builder builder) {
    Message obj = builder.build();

    Call.Builder call = newBuilder();
    call.setExecutorId(org.apache.mesos.v1.Protos.ExecutorID.newBuilder().setValue(System.getenv("MESOS_EXECUTOR_ID")));
    call.setFrameworkId(org.apache.mesos.v1.Protos.FrameworkID.newBuilder().setValue(System.getenv("MESOS_FRAMEWORK_ID")));

    if (obj instanceof Subscribe) {
        call.setSubscribe((Subscribe) obj);
        call.setType(Call.Type.SUBSCRIBE);
    } else if (obj instanceof Call.Message) {
        call.setMessage((Call.Message) obj);
        call.setType(Call.Type.MESSAGE);
    } else if (obj instanceof Update) {
        call.setUpdate((Update) obj);
        call.setType(Call.Type.UPDATE);
    } else
        throw new UnsupportedOperationException("Unsupported object " + obj);

    return call.build();
}
 
开发者ID:elodina,项目名称:java-mesos-util,代码行数:22,代码来源:ExecutorDriverV1.java

示例2: getBuilderForRepeatedChild

import com.google.protobuf.GeneratedMessage; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static final IRepeatedFieldMessageBuilder getBuilderForRepeatedChild(
    final Message.Builder builder, final FieldDescriptor field) {
  if (!field.isRepeated()) {
    throw new IllegalArgumentException("the field must be repeated");
  } else if (field.getJavaType() != JavaType.MESSAGE) {
    throw new IllegalArgumentException("the field must be of Message type");
  } else if (builder.getDescriptorForType() != field.getContainingType()) {
    throw new IllegalArgumentException("the field doen't belong to this type");
  }

  if (builder instanceof GeneratedMessage.Builder) {
    final GeneratedMessage.Builder<?> generatedBuilder = (GeneratedMessage.Builder<?>) builder;
    return getGeneratedRepeatedFieldBuilder(generatedBuilder, field, generatedBuilder.getClass());
  } else if (builder instanceof IBuilder2) {
    return new DynamicRepeatedFieldMessageBuilder((IBuilder2) builder, field);
  } else {
    throw new IllegalArgumentException("builder is not of a supported Builder type");
  }
}
 
开发者ID:protobufel,项目名称:protobuf-el,代码行数:21,代码来源:ProtoLists.java

示例3: newCall

import com.google.protobuf.GeneratedMessage; //导入方法依赖的package包/类
private Call newCall(GeneratedMessage.Builder builder) {
    Message obj = builder != null ? builder.build() : null;
    Protos.FrameworkInfo framework = this.framework.proto1();

    Call.Builder call = Call.newBuilder();
    if (framework.hasId()) call.setFrameworkId(framework.getId());

    if (obj == null) {
        call.setType(Call.Type.TEARDOWN);
    } else if (obj instanceof Call.Subscribe) {
        call.setSubscribe((Call.Subscribe) obj);
        call.setType(Call.Type.SUBSCRIBE);
    } else if (obj instanceof Call.Acknowledge) {
        call.setAcknowledge((Call.Acknowledge) obj);
        call.setType(Call.Type.ACKNOWLEDGE);
    } else if (obj instanceof Call.Kill) {
        call.setKill((Call.Kill) obj);
        call.setType(Call.Type.KILL);
    } else if (obj instanceof Call.Reconcile) {
        call.setReconcile((Call.Reconcile) obj);
        call.setType(Call.Type.RECONCILE);
    } else if (obj instanceof Call.Accept) {
        call.setAccept((Call.Accept) obj);
        call.setType(Call.Type.ACCEPT);
    } else if (obj instanceof Call.Decline) {
        call.setDecline((Call.Decline) obj);
        call.setType(Call.Type.DECLINE);
    } else
        throw new UnsupportedOperationException("Unsupported object " + obj);

    return call.build();
}
 
开发者ID:elodina,项目名称:java-mesos-util,代码行数:33,代码来源:SchedulerDriverV1.java

示例4: readFrom

import com.google.protobuf.GeneratedMessage; //导入方法依赖的package包/类
public Message readFrom(Class<Message> type, java.lang.reflect.Type genericType, Annotation[] annotations,
                        MediaType mediaType, MultivaluedMap<String, String> httpHeaders,
                        InputStream entityStream) throws IOException, WebApplicationException {
    try {
        Method newBuilder = type.getMethod("newBuilder");
        GeneratedMessage.Builder builder = (GeneratedMessage.Builder) newBuilder.invoke(type);
        return builder.mergeFrom(entityStream).build();
    } catch (Exception e) {
        throw new WebApplicationException(e);
    }
}
 
开发者ID:sam6-de,项目名称:RestfulProtobuf,代码行数:12,代码来源:ProtobufMessageBodyReader.java

示例5: UserList

import com.google.protobuf.GeneratedMessage; //导入方法依赖的package包/类
private UserList(GeneratedMessage.Builder<?> builder) {
	super(builder);
	this.unknownFields = builder.getUnknownFields();
}
 
开发者ID:wjlafrance,项目名称:grumble,代码行数:5,代码来源:Mumble.java

示例6: RequestBlob

import com.google.protobuf.GeneratedMessage; //导入方法依赖的package包/类
private RequestBlob(GeneratedMessage.Builder<?> builder) {
	super(builder);
	this.unknownFields = builder.getUnknownFields();
}
 
开发者ID:wjlafrance,项目名称:grumble,代码行数:5,代码来源:Mumble.java

示例7: Stats

import com.google.protobuf.GeneratedMessage; //导入方法依赖的package包/类
private Stats(GeneratedMessage.Builder<?> builder) {
	super(builder);
	this.unknownFields = builder.getUnknownFields();
}
 
开发者ID:wjlafrance,项目名称:grumble,代码行数:5,代码来源:Mumble.java

示例8: getBuilder

import com.google.protobuf.GeneratedMessage; //导入方法依赖的package包/类
@Override
public GeneratedMessage.Builder<?> getBuilder(final P parent, final int index) {
  return invokeMethod(getMethodGetBuilder(), parent, index);
}
 
开发者ID:protobufel,项目名称:protobuf-el,代码行数:5,代码来源:ProtoLists.java

示例9: PermissionDenied

import com.google.protobuf.GeneratedMessage; //导入方法依赖的package包/类
private PermissionDenied(GeneratedMessage.Builder<?> builder) {
	super(builder);
	this.unknownFields = builder.getUnknownFields();
}
 
开发者ID:wjlafrance,项目名称:grumble,代码行数:5,代码来源:Mumble.java

示例10: getProtoBuilder

import com.google.protobuf.GeneratedMessage; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public <T extends GeneratedMessage.Builder<T>> T getProtoBuilder() {
  return (T) currentScope.protoBuilder;
}
 
开发者ID:protobufel,项目名称:protobuf-el,代码行数:5,代码来源:Scopes.java

示例11: CodecVersion

import com.google.protobuf.GeneratedMessage; //导入方法依赖的package包/类
private CodecVersion(GeneratedMessage.Builder<?> builder) {
	super(builder);
	this.unknownFields = builder.getUnknownFields();
}
 
开发者ID:wjlafrance,项目名称:grumble,代码行数:5,代码来源:Mumble.java

示例12: ACL

import com.google.protobuf.GeneratedMessage; //导入方法依赖的package包/类
private ACL(GeneratedMessage.Builder<?> builder) {
	super(builder);
	this.unknownFields = builder.getUnknownFields();
}
 
开发者ID:wjlafrance,项目名称:grumble,代码行数:5,代码来源:Mumble.java

示例13: ContextActionModify

import com.google.protobuf.GeneratedMessage; //导入方法依赖的package包/类
private ContextActionModify(GeneratedMessage.Builder<?> builder) {
	super(builder);
	this.unknownFields = builder.getUnknownFields();
}
 
开发者ID:wjlafrance,项目名称:grumble,代码行数:5,代码来源:Mumble.java

示例14: Target

import com.google.protobuf.GeneratedMessage; //导入方法依赖的package包/类
private Target(GeneratedMessage.Builder<?> builder) {
	super(builder);
	this.unknownFields = builder.getUnknownFields();
}
 
开发者ID:wjlafrance,项目名称:grumble,代码行数:5,代码来源:Mumble.java

示例15: QueryUsers

import com.google.protobuf.GeneratedMessage; //导入方法依赖的package包/类
private QueryUsers(GeneratedMessage.Builder<?> builder) {
	super(builder);
	this.unknownFields = builder.getUnknownFields();
}
 
开发者ID:wjlafrance,项目名称:grumble,代码行数:5,代码来源:Mumble.java


注:本文中的com.google.protobuf.GeneratedMessage.Builder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。