本文整理汇总了Java中com.google.common.collect.HashBiMap.put方法的典型用法代码示例。如果您正苦于以下问题:Java HashBiMap.put方法的具体用法?Java HashBiMap.put怎么用?Java HashBiMap.put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.HashBiMap
的用法示例。
在下文中一共展示了HashBiMap.put方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: build
import com.google.common.collect.HashBiMap; //导入方法依赖的package包/类
GqlInputConverter build() {
HashBiMap<String, Descriptor> mapping = HashBiMap.create();
HashBiMap<String, EnumDescriptor> enumMapping = HashBiMap.create(getEnumMap(enumDescriptors));
LinkedList<Descriptor> loop = new LinkedList<>(descriptors);
Set<FileDescriptor> fileDescriptorSet = ProtoRegistry.extractDependencies(fileDescriptors);
for (FileDescriptor fileDescriptor : fileDescriptorSet) {
loop.addAll(fileDescriptor.getMessageTypes());
enumMapping.putAll(getEnumMap(fileDescriptor.getEnumTypes()));
}
while (!loop.isEmpty()) {
Descriptor descriptor = loop.pop();
if (!mapping.containsKey(descriptor.getFullName())) {
mapping.put(getReferenceName(descriptor), descriptor);
loop.addAll(descriptor.getNestedTypes());
enumMapping.putAll(getEnumMap(descriptor.getEnumTypes()));
}
}
return new GqlInputConverter(
ImmutableBiMap.copyOf(mapping), ImmutableBiMap.copyOf(enumMapping));
}
示例2: getEnumMap
import com.google.common.collect.HashBiMap; //导入方法依赖的package包/类
private static BiMap<String, EnumDescriptor> getEnumMap(Iterable<EnumDescriptor> descriptors) {
HashBiMap<String, EnumDescriptor> mapping = HashBiMap.create();
for (EnumDescriptor enumDescriptor : descriptors) {
mapping.put(ProtoToGql.getReferenceName(enumDescriptor), enumDescriptor);
}
return mapping;
}
示例3: getMap
import com.google.common.collect.HashBiMap; //导入方法依赖的package包/类
private static BiMap<String, GraphQLType> getMap(
List<FileDescriptor> fileDescriptors,
List<Descriptor> descriptors,
List<EnumDescriptor> enumDescriptors,
GraphQLInterfaceType nodeInterface) {
HashBiMap<String, GraphQLType> mapping = HashBiMap.create(getEnumMap(enumDescriptors));
LinkedList<Descriptor> loop = new LinkedList<>(descriptors);
Set<FileDescriptor> fileDescriptorSet = extractDependencies(fileDescriptors);
for (FileDescriptor fileDescriptor : fileDescriptorSet) {
loop.addAll(fileDescriptor.getMessageTypes());
mapping.putAll(getEnumMap(fileDescriptor.getEnumTypes()));
}
while (!loop.isEmpty()) {
Descriptor descriptor = loop.pop();
if (!mapping.containsKey(descriptor.getFullName())) {
mapping.put(
ProtoToGql.getReferenceName(descriptor),
ProtoToGql.convert(descriptor, nodeInterface));
GqlInputConverter inputConverter =
GqlInputConverter.newBuilder().add(descriptor.getFile()).build();
mapping.put(
GqlInputConverter.getReferenceName(descriptor),
inputConverter.getInputType(descriptor));
loop.addAll(descriptor.getNestedTypes());
mapping.putAll(getEnumMap(descriptor.getEnumTypes()));
}
}
return ImmutableBiMap.copyOf(mapping);
}
示例4: getEnumMap
import com.google.common.collect.HashBiMap; //导入方法依赖的package包/类
private static BiMap<String, GraphQLType> getEnumMap(Iterable<EnumDescriptor> descriptors) {
HashBiMap<String, GraphQLType> mapping = HashBiMap.create();
for (EnumDescriptor enumDescriptor : descriptors) {
mapping.put(
ProtoToGql.getReferenceName(enumDescriptor), ProtoToGql.convert(enumDescriptor));
}
return mapping;
}
示例5: generateHashBiMap
import com.google.common.collect.HashBiMap; //导入方法依赖的package包/类
@Generates private static <K, V> HashBiMap<K, V> generateHashBiMap(K key, V value) {
HashBiMap<K, V> bimap = HashBiMap.create();
bimap.put(key, value);
return bimap;
}