本文整理汇总了Java中com.google.protobuf.GeneratedMessage.Builder类的典型用法代码示例。如果您正苦于以下问题:Java Builder类的具体用法?Java Builder怎么用?Java Builder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Builder类属于com.google.protobuf.GeneratedMessage包,在下文中一共展示了Builder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: serialize
import com.google.protobuf.GeneratedMessage.Builder; //导入依赖的package包/类
@Override
public FileFragmentProto serialize(FileFragment fragment) {
FileFragmentProto.Builder builder = FileFragmentProto.newBuilder();
builder.setId(fragment.inputSourceId);
builder.setStartOffset(fragment.startKey);
builder.setLength(fragment.length);
builder.setPath(fragment.getPath().toString());
if(fragment.getDiskIds() != null) {
List<Integer> idList = new ArrayList<>();
for(int eachId: fragment.getDiskIds()) {
idList.add(eachId);
}
builder.addAllDiskIds(idList);
}
if(fragment.hostNames != null) {
builder.addAllHosts(fragment.hostNames);
}
return builder.build();
}
开发者ID:apache,项目名称:tajo,代码行数:21,代码来源:FileFragmentSerde.java
示例2: readRecord
import com.google.protobuf.GeneratedMessage.Builder; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public void readRecord(long fromInstanceId, long toInstanceId, ReadRecordCallback<Builder<? extends Builder>> readCallback) throws IOException,
UnsupportedChecksumAlgorithm, FileDamageException {
long tempInstanceId = fromInstanceId;
DataChunk endChunk = null;
while (true) {
DataChunk chunk = fileIndexer.findDataChunk(tempInstanceId);
if (chunk != null) {
ReadResult r = chunk.readRecord(tempInstanceId, toInstanceId, readCallback);
tempInstanceId = r.getMaxSuccessInstanceId() + 1;
if (chunk == endChunk) {
break;
}
endChunk = chunk;
} else {
break;
}
}
}
开发者ID:qinannmj,项目名称:FireFly,代码行数:21,代码来源:RecordFileOperatorV2.java
示例3: newInstance
import com.google.protobuf.GeneratedMessage.Builder; //导入依赖的package包/类
@Override
public Builder<?> newInstance(byte msgId) {
Method builder = builders.get(Integer.valueOf(msgId));
if (builder == null) return null;
try {
return (Builder<?>) builder.invoke(null);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
throw new RuntimeException ("Unable to create new builder instance for msgId " + msgId, e);
}
}
开发者ID:salesforce,项目名称:coyote,代码行数:12,代码来源:MessageMapperImpl.java
示例4: read
import com.google.protobuf.GeneratedMessage.Builder; //导入依赖的package包/类
@Override
public void read(long instanceId, Builder<? extends Builder> b) {
if (b instanceof SuccessfulRecord.Builder) {
sortedReadCallback.read(instanceId, (SuccessfulRecord.Builder)b);
} else {
try {
out.writeVoteRecord(instanceId, (InstanceVoteRecord) b.build(), null);
}catch (Throwable e) {
logger.error("upgrade error", e);
isError = true;
}
}
}
开发者ID:qinannmj,项目名称:FireFly,代码行数:14,代码来源:VersionUpgradeTool.java
示例5: initRead
import com.google.protobuf.GeneratedMessage.Builder; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
public ReadResult initRead(long startInstanceId, ReadRecordCallback<Builder<? extends Builder>> readCallback) throws IOException,
UnsupportedChecksumAlgorithm {
if (logger.isDebugEnabled()) {
logger.debug(String.format("initRead from:%s file:%s", startInstanceId, file.getAbsoluteFile()));
}
ReadResult r = readRecord(startInstanceId, Long.MAX_VALUE, readCallback);
used = r.pos;
if (this.maxVoteInstanceId < r.maxVoteInstanceId) {
this.maxVoteInstanceId = r.maxVoteInstanceId;
}
this.successfullInstanceId = r.maxSuccessInstanceId;
return r;
}
开发者ID:qinannmj,项目名称:FireFly,代码行数:15,代码来源:DataChunk.java
示例6: writeSuccess
import com.google.protobuf.GeneratedMessage.Builder; //导入依赖的package包/类
public void writeSuccess(long instanceId, SuccessfulRecord.Builder successRecord, Record record,Callable<Object> realEvent) throws IOException, ChunkFullException {
if (successfullInstanceId >= instanceId) {
//the success has written and give up write,
return;
} else if (successfullInstanceId + 1 == instanceId) {
checkBufferout();
int recordLen = record.getSerializeSize();
if (maxVoteInstanceId >= instanceId || capacity >= (used + recordLen)) {
record.writeToStream(writeStream, realEvent, realEvent != null);
++successfullInstanceId;
if (successRecord.getV().getType() == ValueType.PLACE.getValue()) {
long value = LongUtil.toLong(successRecord.getV().getValues().toByteArray(), 0);
if (value > successfullInstanceId) {
successfullInstanceId = value;
}
}
used += recordLen;
} else {
throw new ChunkFullException();
}
} else {
throw new RuntimeException(String.format("excepted successful instanceId %s , give instanceId %s", successfullInstanceId + 1, instanceId));
}
if (logger.isDebugEnabled()) {
logger.debug("instanceId:" + instanceId + " isPlace " + (successRecord.getV().getType() == ValueType.PLACE.getValue()) + " successfullInstanceId "
+ successfullInstanceId);
}
}
开发者ID:qinannmj,项目名称:FireFly,代码行数:30,代码来源:DataChunk.java
示例7: InstanceSaveContext
import com.google.protobuf.GeneratedMessage.Builder; //导入依赖的package包/类
public InstanceSaveContext(long instanceId, cn.com.sparkle.firefly.stablestorage.model.StoreModel.SuccessfulRecord.Builder successfulRecord,
LinkedList<AddRequestPackage> addRequestPackages) {
super();
this.instanceId = instanceId;
this.successfulRecord = successfulRecord;
this.addRequestPackages = addRequestPackages;
}
开发者ID:qinannmj,项目名称:FireFly,代码行数:8,代码来源:RecordFileOperatorV2.java
示例8: toProtobuf
import com.google.protobuf.GeneratedMessage.Builder; //导入依赖的package包/类
/**
*
* @param obj
* @param protobuf
* @return
*/
public static <X extends Builder<X>> X toProtobuf(Object obj, X protobuf) {
if (null == obj || null == protobuf) {
return null;
}
List<Method> methods = WizardReflexUtil.getGetMethods(obj);
for (Method method : methods) {
setProtobuf(obj, protobuf, method);
}
return protobuf;
}
开发者ID:joaquinaimar,项目名称:wizard,代码行数:20,代码来源:WizardProtobufUtil.java
示例9: toObject
import com.google.protobuf.GeneratedMessage.Builder; //导入依赖的package包/类
/**
*
* @param protobuf
* @param obj
* @return
*/
public static <X> X toObject(Builder<?> protobuf, X obj) {
if (null == protobuf || null == obj) {
return null;
}
Set<FieldDescriptor> fieldSet = protobuf.getAllFields().keySet();
for (FieldDescriptor field : fieldSet) {
setObject(protobuf, obj, field);
}
return obj;
}
开发者ID:joaquinaimar,项目名称:wizard,代码行数:21,代码来源:WizardProtobufUtil.java
示例10: newInstance
import com.google.protobuf.GeneratedMessage.Builder; //导入依赖的package包/类
/** @return a new message builder for this messageId, or null if the messageId is unknown */
public Builder<?> newInstance(byte messageId);
开发者ID:salesforce,项目名称:coyote,代码行数:3,代码来源:MessageMapper.java
示例11: newInstance
import com.google.protobuf.GeneratedMessage.Builder; //导入依赖的package包/类
@Override
public Builder<?> newInstance(byte messageId) {
throw new UnsupportedOperationException();
}
开发者ID:salesforce,项目名称:coyote,代码行数:5,代码来源:AcceptAllMessageMapper.java
示例12: newBuilder
import com.google.protobuf.GeneratedMessage.Builder; //导入依赖的package包/类
@Override
public Builder newBuilder() {
return ExampleHttpFileFragmentProto.newBuilder();
}
开发者ID:apache,项目名称:tajo,代码行数:5,代码来源:ExampleHttpFileFragmentSerde.java
示例13: newBuilder
import com.google.protobuf.GeneratedMessage.Builder; //导入依赖的package包/类
@Override
public Builder newBuilder() {
return FileFragmentProto.newBuilder();
}
开发者ID:apache,项目名称:tajo,代码行数:5,代码来源:FileFragmentSerde.java
示例14: newBuilder
import com.google.protobuf.GeneratedMessage.Builder; //导入依赖的package包/类
@Override
public Builder newBuilder() {
return JdbcFragmentProto.newBuilder();
}
开发者ID:apache,项目名称:tajo,代码行数:5,代码来源:JdbcFragmentSerde.java
示例15: newBuilder
import com.google.protobuf.GeneratedMessage.Builder; //导入依赖的package包/类
@Override
public Builder newBuilder() {
return KafkaFragmentProto.newBuilder();
}
开发者ID:apache,项目名称:tajo,代码行数:5,代码来源:KafkaFragmentSerde.java
示例16: newBuilder
import com.google.protobuf.GeneratedMessage.Builder; //导入依赖的package包/类
@Override
public Builder newBuilder() {
return HBaseFragmentProto.newBuilder();
}
开发者ID:apache,项目名称:tajo,代码行数:5,代码来源:HBaseFragmentSerde.java
示例17: SplitReader
import com.google.protobuf.GeneratedMessage.Builder; //导入依赖的package包/类
public SplitReader(RecordFileOperator out, long exceptedNextId) {
this.out = out;
successReader = new SuccessReader(out);
sortedReadCallback = new SortedReadCallback<SuccessfulRecord.Builder>(successReader, exceptedNextId);
}
开发者ID:qinannmj,项目名称:FireFly,代码行数:6,代码来源:VersionUpgradeTool.java
示例18: getSuccessfulRecord
import com.google.protobuf.GeneratedMessage.Builder; //导入依赖的package包/类
public SuccessfulRecord.Builder getSuccessfulRecord() {
return successfulRecord;
}
开发者ID:qinannmj,项目名称:FireFly,代码行数:4,代码来源:RecordFileOperatorV2.java
示例19: writeSuccessfulRecord
import com.google.protobuf.GeneratedMessage.Builder; //导入依赖的package包/类
public boolean writeSuccessfulRecord(long instanceId, SuccessfulRecord.Builder successfulRecord, LinkedList<AddRequestPackage> addRequestPackages,
final Callable<Object> realEvent) throws IOException, UnsupportedChecksumAlgorithm;
开发者ID:qinannmj,项目名称:FireFly,代码行数:3,代码来源:RecordFileOperator.java
示例20: read
import com.google.protobuf.GeneratedMessage.Builder; //导入依赖的package包/类
@Override
public final void read(long instanceId, Builder<? extends Builder> b) {
if (b instanceof SuccessfulRecord.Builder) {
readSuccess(instanceId, (SuccessfulRecord.Builder) b);
}
}
开发者ID:qinannmj,项目名称:FireFly,代码行数:7,代码来源:ReadSuccessRecordCallback.java
注:本文中的com.google.protobuf.GeneratedMessage.Builder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论