本文整理汇总了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();
}
示例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");
}
}
示例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();
}
示例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);
}
}
示例5: UserList
import com.google.protobuf.GeneratedMessage; //导入方法依赖的package包/类
private UserList(GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
示例6: RequestBlob
import com.google.protobuf.GeneratedMessage; //导入方法依赖的package包/类
private RequestBlob(GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
示例7: Stats
import com.google.protobuf.GeneratedMessage; //导入方法依赖的package包/类
private Stats(GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
示例8: getBuilder
import com.google.protobuf.GeneratedMessage; //导入方法依赖的package包/类
@Override
public GeneratedMessage.Builder<?> getBuilder(final P parent, final int index) {
return invokeMethod(getMethodGetBuilder(), parent, index);
}
示例9: PermissionDenied
import com.google.protobuf.GeneratedMessage; //导入方法依赖的package包/类
private PermissionDenied(GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
示例10: getProtoBuilder
import com.google.protobuf.GeneratedMessage; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public <T extends GeneratedMessage.Builder<T>> T getProtoBuilder() {
return (T) currentScope.protoBuilder;
}
示例11: CodecVersion
import com.google.protobuf.GeneratedMessage; //导入方法依赖的package包/类
private CodecVersion(GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
示例12: ACL
import com.google.protobuf.GeneratedMessage; //导入方法依赖的package包/类
private ACL(GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
示例13: ContextActionModify
import com.google.protobuf.GeneratedMessage; //导入方法依赖的package包/类
private ContextActionModify(GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
示例14: Target
import com.google.protobuf.GeneratedMessage; //导入方法依赖的package包/类
private Target(GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
示例15: QueryUsers
import com.google.protobuf.GeneratedMessage; //导入方法依赖的package包/类
private QueryUsers(GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}