當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。