本文整理汇总了Java中com.google.protobuf.ProtocolStringList类的典型用法代码示例。如果您正苦于以下问题:Java ProtocolStringList类的具体用法?Java ProtocolStringList怎么用?Java ProtocolStringList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProtocolStringList类属于com.google.protobuf包,在下文中一共展示了ProtocolStringList类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: generateFile
import com.google.protobuf.ProtocolStringList; //导入依赖的package包/类
public void generateFile(String protoPath) {
try {
if (pojoTypes == null) {
pojoTypes = Maps.newHashMap();
}
} finally {
if (!new File(protoPath).exists()) {
logger.warn("protoPath:" + protoPath
+ " not exist, it may be in the third party jars, so it can't be generate");
return;
}
FileDescriptorSet fileDescriptorSet = commondProtoc.invoke(protoPath);
for (FileDescriptorProto fdp : fileDescriptorSet.getFileList()) {
Pair<String, String> packageClassName = this.packageClassName(fdp.getOptions());
if (packageClassName == null) {
continue;
}
ProtocolStringList dependencyList = fdp.getDependencyList();
for (Iterator<String> it = dependencyList.iterator(); it.hasNext();) {
String dependencyPath = discoveryRoot + "/" + it.next();
generateFile(dependencyPath);
}
doPrint(fdp, packageClassName.getLeft(), packageClassName.getRight());
}
}
}
开发者ID:venus-boot,项目名称:saluki,代码行数:27,代码来源:CommonProto2Java.java
示例2: messageForFilter
import com.google.protobuf.ProtocolStringList; //导入依赖的package包/类
private static <M extends Message, B extends Message.Builder> M messageForFilter(
ProtocolStringList filter,
Constructor<B> builderConstructor, Message wholeMessage)
throws InstantiationException,
IllegalAccessException,
InvocationTargetException {
final B builder = builderConstructor.newInstance();
final List<Descriptors.FieldDescriptor> fields = wholeMessage.getDescriptorForType()
.getFields();
for (Descriptors.FieldDescriptor field : fields) {
if (filter.contains(field.getFullName())) {
builder.setField(field, wholeMessage.getField(field));
}
}
@SuppressWarnings("unchecked")
// It's fine as the constructor is of {@code MessageCls.Builder} type.
final M result = (M) builder.build();
return result;
}
开发者ID:SpineEventEngine,项目名称:core-java,代码行数:21,代码来源:FieldMasks.java
示例3: tryRemoveFromGroup
import com.google.protobuf.ProtocolStringList; //导入依赖的package包/类
public static void tryRemoveFromGroup(UnitConfigType.UnitConfig group, String userId) throws CouldNotPerformException,
InterruptedException {
UnitConfigType.UnitConfig.Builder unitConfig = Registries.getUserRegistry().getAuthorizationGroupConfigById(group.getId()).toBuilder();
AuthorizationGroupConfigType.AuthorizationGroupConfig.Builder authorizationGroupConfig = unitConfig.getAuthorizationGroupConfigBuilder();
ProtocolStringList members = authorizationGroupConfig.getMemberIdList();
authorizationGroupConfig.clearMemberId();
for (String member : members) {
if (!member.equals(userId)) {
authorizationGroupConfig.addMemberId(member);
}
}
Registries.getUserRegistry().updateAuthorizationGroupConfig(unitConfig.build());
}
开发者ID:openbase,项目名称:bco.bcozy,代码行数:19,代码来源:AuthorizationGroups.java
示例4: batchRegister
import com.google.protobuf.ProtocolStringList; //导入依赖的package包/类
@Override
public void batchRegister(NetworkAddresses request, StreamObserver<NetworkAddressMappings> responseObserver) {
logger.debug("register application");
ProtocolStringList addressesList = request.getAddressesList();
NetworkAddressMappings.Builder builder = NetworkAddressMappings.newBuilder();
for (int i = 0; i < addressesList.size(); i++) {
String networkAddress = addressesList.get(i);
int addressId = networkAddressIDService.getOrCreate(networkAddress);
if (addressId != 0) {
KeyWithIntegerValue value = KeyWithIntegerValue.newBuilder().setKey(networkAddress).setValue(addressId).build();
builder.addAddressIds(value);
}
}
responseObserver.onNext(builder.build());
responseObserver.onCompleted();
}
开发者ID:apache,项目名称:incubator-skywalking,代码行数:19,代码来源:NetworkAddressRegisterServiceHandler.java
示例5: removeDuplicates
import com.google.protobuf.ProtocolStringList; //导入依赖的package包/类
/**
* Cleans the currently built commandHandlers from the duplicates.
*
* <p>Calling this method will cause the {@linkplain #commandHandlers current commandHandlers}
* not to contain duplicate entries in any {@code repeated} field.
*/
private void removeDuplicates() {
final ProtocolStringList handlingTypesList = commandHandlers.getCommandHandlingTypesList();
final Set<String> commandHandlingTypes = newTreeSet(handlingTypesList);
commandHandlers.clearCommandHandlingTypes()
.addAllCommandHandlingTypes(commandHandlingTypes);
}
开发者ID:SpineEventEngine,项目名称:core-java,代码行数:13,代码来源:AssignLookup.java
示例6: verifyMultiplePathsInQuery
import com.google.protobuf.ProtocolStringList; //导入依赖的package包/类
private static void verifyMultiplePathsInQuery(String[] paths,
Query readAllWithPathFilteringQuery) {
final FieldMask fieldMask = readAllWithPathFilteringQuery.getFieldMask();
assertEquals(paths.length, fieldMask.getPathsCount());
final ProtocolStringList pathsList = fieldMask.getPathsList();
for (String expectedPath : paths) {
assertTrue(pathsList.contains(expectedPath));
}
}
开发者ID:SpineEventEngine,项目名称:core-java,代码行数:10,代码来源:QueryFactoryShould.java
示例7: applyMask
import com.google.protobuf.ProtocolStringList; //导入依赖的package包/类
/**
* Applies the given {@code FieldMask} to given collection of {@link Message}s.
* Does not change the {@link Collection} itself.
*
* <p>In case the {@code FieldMask} instance contains invalid field declarations, they are
* ignored and do not affect the execution result.
*
* @param mask {@code FieldMask} to apply to each item of the input {@link Collection}.
* @param messages {@link Message}s to filter.
* @param type type of the {@link Message}s.
* @return messages with the {@code FieldMask} applied
*/
@Nonnull
public static <M extends Message, B extends Message.Builder>
Collection<M> applyMask(FieldMask mask,
Collection<M> messages,
TypeUrl type) {
checkNotNull(mask);
checkNotNull(messages);
checkNotNull(type);
final List<M> filtered = new LinkedList<>();
final ProtocolStringList filter = mask.getPathsList();
final Class<B> builderClass = getBuilderForType(type);
if (filter.isEmpty() || builderClass == null) {
return Collections.unmodifiableCollection(messages);
}
try {
final Constructor<B> builderConstructor = builderClass.getDeclaredConstructor();
builderConstructor.setAccessible(true);
for (Message wholeMessage : messages) {
final M message = messageForFilter(filter, builderConstructor, wholeMessage);
filtered.add(message);
}
} catch (NoSuchMethodException |
InvocationTargetException |
IllegalAccessException |
InstantiationException e) {
// If any reflection failure happens, return all the data without any mask applied.
log().warn(format(CONSTRUCTOR_INVOCATION_ERROR_LOGGING_PATTERN,
builderClass.getCanonicalName()),
e);
return Collections.unmodifiableCollection(messages);
}
return Collections.unmodifiableList(filtered);
}
开发者ID:SpineEventEngine,项目名称:core-java,代码行数:50,代码来源:FieldMasks.java
示例8: doApply
import com.google.protobuf.ProtocolStringList; //导入依赖的package包/类
private static <M extends Message, B extends Message.Builder> M doApply(FieldMask mask,
M message,
TypeUrl type) {
checkNotNull(mask);
checkNotNull(message);
checkNotNull(type);
final ProtocolStringList filter = mask.getPathsList();
final Class<B> builderClass = getBuilderForType(type);
if (builderClass == null) {
return message;
}
try {
final Constructor<B> builderConstructor = builderClass.getDeclaredConstructor();
builderConstructor.setAccessible(true);
final M result = messageForFilter(filter, builderConstructor, message);
return result;
} catch (NoSuchMethodException |
InvocationTargetException |
IllegalAccessException |
InstantiationException e) {
log().warn(format(CONSTRUCTOR_INVOCATION_ERROR_LOGGING_PATTERN,
builderClass.getCanonicalName()),
e);
return message;
}
}
开发者ID:SpineEventEngine,项目名称:core-java,代码行数:31,代码来源:FieldMasks.java
示例9: processElement
import com.google.protobuf.ProtocolStringList; //导入依赖的package包/类
@Override
public void processElement(DoFn<WorkPacketConfig, Map<Integer, List<WorkPacketKey>>>.ProcessContext c)
throws Exception {
long keyCount = 0;
// Now we build the cartesian join and emit each pair forward, we ignore
// self joins and transitive joins {a,b,c} become {a-b,a-c,b-c}
Set<String> transList = new HashSet<String>();
Map<Integer, List<WorkPacketKey>> keysForPartition = new HashMap<>();
ProtocolStringList keyList = c.element().getKeysList();
for (String outer : keyList) {
for (String inner : keyList) {
String key = WorkPacketUtils.createKey(outer, inner);
if (!outer.equals(inner) && !transList.contains(key)) {
int partition = WorkPacketUtils.getMyPartitions(c.element(), key);
++keyCount;
if (!keysForPartition.containsKey(partition)) {
keysForPartition.put(partition, new ArrayList<WorkPacketKey>());
}
keysForPartition.get(partition)
.add(WorkPacketKey.newBuilder().setKey1(inner).setKey2(outer).build());
transList.add(key);
}
}
}
// TODO: Check for empty list
c.output(keysForPartition);
LOG.info(String.format("Number of Keys was %s Number of partitions are %s", keyCount,
c.element().getPartitionLength()));
}
开发者ID:GoogleCloudPlatform,项目名称:data-timeseries-java,代码行数:45,代码来源:CreatePartitionKeysDoFn.java
注:本文中的com.google.protobuf.ProtocolStringList类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论