本文整理匯總了Java中com.google.common.collect.ImmutableBiMap.copyOf方法的典型用法代碼示例。如果您正苦於以下問題:Java ImmutableBiMap.copyOf方法的具體用法?Java ImmutableBiMap.copyOf怎麽用?Java ImmutableBiMap.copyOf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.common.collect.ImmutableBiMap
的用法示例。
在下文中一共展示了ImmutableBiMap.copyOf方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: build
import com.google.common.collect.ImmutableBiMap; //導入方法依賴的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: Support
import com.google.common.collect.ImmutableBiMap; //導入方法依賴的package包/類
Support(final Expr expr, final String body, final Set<URI> properties,
final Map<String, String> namespaces) {
super(null, XPathFunction.CONTEXT, VARIABLES, XPathNavigator.INSTANCE);
final StringBuilder builder = new StringBuilder();
for (final String prefix : Ordering.natural().sortedCopy(namespaces.keySet())) {
final String namespace = namespaces.get(prefix);
if (!namespace.equals(Data.getNamespaceMap().get(prefix))) {
builder.append(builder.length() == 0 ? "" : ", ").append(prefix).append(": ")
.append("<").append(namespace).append(">");
}
}
final String head = builder.toString();
this.string = head.isEmpty() ? body : "with " + head + " : " + body;
this.head = head.isEmpty() ? "" : this.string.substring(5, 5 + head.length());
this.body = head.isEmpty() ? body : this.string.substring(8 + head.length());
this.expr = expr;
this.properties = properties;
this.namespaces = ImmutableBiMap.copyOf(namespaces);
}
示例3: getMap
import com.google.common.collect.ImmutableBiMap; //導入方法依賴的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: create
import com.google.common.collect.ImmutableBiMap; //導入方法依賴的package包/類
@Override
protected BiMap<String, String> create(Entry<String, String>[] entries) {
Map<String, String> builder = Maps.newLinkedHashMap();
for (Entry<String, String> entry : entries) {
builder.put(entry.getKey(), entry.getValue());
}
return ImmutableBiMap.copyOf(builder);
}
示例5: getABFMapper
import com.google.common.collect.ImmutableBiMap; //導入方法依賴的package包/類
public static ImmutableBiMap<String,String> getABFMapper() {
String serviceURL = null;
ImmutableBiMap<String,String> ABFMAPPER = null;
try {
serviceURL = System.getenv("authcode.service.URL");
if (serviceURL == null)
serviceURL = System.getProperty("authcode.service.URL","http://localhost:9876/references");
LOG.info("Initializing ABF Reference with remote service URL: "+ serviceURL);
Client client = Client.create();
WebResource webResource = client.resource(serviceURL);
ClientResponse response = webResource.accept("application/json")
.get(ClientResponse.class);
String output = response.getEntity(String.class);
if (response.getStatus() == 200 && output != null && !output.isEmpty()) {
Map<String, String> mapResponse = OBJECT_MAPPER.readValue(output, new TypeReference<Map<String, String>>() {});
ABFMAPPER = ImmutableBiMap.copyOf(Collections.unmodifiableMap(mapResponse));
LOG.info("Success on getting ABF Reference map from "+ serviceURL);
} else {
ABFMAPPER = ImmutableBiMap.copyOf(Collections.unmodifiableMap(ABFCodeMap.defaultABFMapper()));
}
}catch(Exception ex){
ABFMAPPER = ImmutableBiMap.copyOf(Collections.unmodifiableMap(ABFCodeMap.defaultABFMapper()));
LOG.warn("ABF Mapper initialization failed");
}
return ABFMAPPER;
}
示例6: getModObjectList
import com.google.common.collect.ImmutableBiMap; //導入方法依賴的package包/類
public BiMap<ModContainer, Object> getModObjectList()
{
if (modObjectList == null)
{
FMLLog.severe("Detected an attempt by a mod %s to perform game activity during mod construction. This is a serious programming error.", activeContainer);
return buildModObjectList();
}
return ImmutableBiMap.copyOf(modObjectList);
}
示例7: testGetTokenDefMap_02
import com.google.common.collect.ImmutableBiMap; //導入方法依賴的package包/類
@Test public void testGetTokenDefMap_02() {
ITokenDefProvider tokenDefProvider = get(ITokenDefProvider.class);
ImmutableBiMap<Integer, String> tokens = ImmutableBiMap.copyOf(tokenDefProvider.getTokenDefMap());
ImmutableBiMap<String,Integer> inverseTokens = tokens.inverse();
assertTrue("'\n'", inverseTokens.containsKey("'\n'"));
assertTrue("'\r'", inverseTokens.containsKey("'\r'"));
assertTrue("RULE_ID", inverseTokens.containsKey("RULE_ID"));
assertTrue("RULE_ANY_OTHER", inverseTokens.containsKey("RULE_ANY_OTHER"));
assertTrue("RULE_WS", inverseTokens.containsKey("RULE_WS"));
}
示例8: getLocalEndpoint
import com.google.common.collect.ImmutableBiMap; //導入方法依賴的package包/類
public String getLocalEndpoint() throws ReaperException {
String cassandraVersion = getCassandraVersion();
if (versionCompare(cassandraVersion, "2.1.10") >= 0) {
return ((StorageServiceMBean) ssProxy)
.getHostIdToEndpoint()
.get(((StorageServiceMBean) ssProxy).getLocalHostId());
} else {
// pre-2.1.10 compatibility
BiMap<String, String> hostIdBiMap =
ImmutableBiMap.copyOf(((StorageServiceMBean) ssProxy).getHostIdMap());
String localHostId = ((StorageServiceMBean) ssProxy).getLocalHostId();
return hostIdBiMap.inverse().get(localHostId);
}
}
示例9: create
import com.google.common.collect.ImmutableBiMap; //導入方法依賴的package包/類
@Override protected BiMap<String, String> create(Entry<String, String>[] entries) {
Map<String, String> builder = Maps.newLinkedHashMap();
for (Entry<String, String> entry : entries) {
builder.put(entry.getKey(), entry.getValue());
}
return ImmutableBiMap.copyOf(builder);
}
示例10: getResult
import com.google.common.collect.ImmutableBiMap; //導入方法依賴的package包/類
@Override
public Mappings getResult() {
ImmutableBiMap<JavaType, JavaType> types = ImmutableBiMap.copyOf(this.types);
ImmutableBiMap.Builder<MethodData, MethodData> methods = ImmutableBiMap.builder();
ImmutableBiMap.Builder<FieldData, FieldData> fields = ImmutableBiMap.builder();
this.methods.forEach((originalData, newName) -> methods.put(originalData, originalData
.mapTypes(original -> types.getOrDefault(original, original))
.withName(newName)));
this.fields.forEach((originalData, newName) -> fields.put(originalData, originalData
.mapTypes(original -> types.getOrDefault(original, original))
.withName(newName)));
return ImmutableMappings.create(types, methods.build(), fields.build());
}
示例11: EnumArg
import com.google.common.collect.ImmutableBiMap; //導入方法依賴的package包/類
private EnumArg(BiMap<E, String> args, String name) {
super(name);
this.args = ImmutableBiMap.copyOf(args);
}
示例12: ofImmutable
import com.google.common.collect.ImmutableBiMap; //導入方法依賴的package包/類
static <N, E> UndirectedNetworkConnections<N, E> ofImmutable(Map<E, N> incidentEdges) {
return new UndirectedNetworkConnections<N, E>(ImmutableBiMap.copyOf(incidentEdges));
}
示例13: ofImmutable
import com.google.common.collect.ImmutableBiMap; //導入方法依賴的package包/類
static <N, E> DirectedNetworkConnections<N, E> ofImmutable(
Map<E, N> inEdges, Map<E, N> outEdges, int selfLoopCount) {
return new DirectedNetworkConnections<N, E>(
ImmutableBiMap.copyOf(inEdges), ImmutableBiMap.copyOf(outEdges), selfLoopCount);
}
示例14: ObfuscatedStateMapper
import com.google.common.collect.ImmutableBiMap; //導入方法依賴的package包/類
protected ObfuscatedStateMapper() {
LOGGER.info("Using build mapping \"" + ForgeHaxProperties.getMcpMappingUrl() + "\"");
MCPMappingLoader mcpMappingLoader = null;
try {
mcpMappingLoader = new MCPMappingLoader(ForgeHaxProperties.getMcpMappingUrl());
} catch (Exception e) {
LOGGER.error(e.getMessage());
ASMStackLogger.printStackTrace(e);
}
LOGGER.info("Mapping data successfully initialize");
Objects.requireNonNull(mcpMappingLoader, "MCPMappingLoader failed to lookup obfuscation data");
if(isObfuscated())
LOGGER.info("initializing ObfuscatedStateMapper WITH obfuscation");
else
LOGGER.info("initializing ObfuscatedStateMapper WITHOUT obfuscation");
this.mcClasses = ImmutableBiMap.copyOf(FastReflectionForge.Fields.FMLDeobfuscatingRemapper_classNameBiMap.get(FMLDeobfuscatingRemapper.INSTANCE));
this.mcpMethodData = buildMcpTypeData(
mcpMappingLoader.getCsvMethodData(),
mcpMappingLoader.getSrgFileData().class2MethodDataSet,
getConvertedMap(
FastReflectionForge.Fields.FMLDeobfuscatingRemapper_rawMethodMaps.get(FMLDeobfuscatingRemapper.INSTANCE),
str -> str.split("\\(")[0]
),
((csvData, data) -> csvData.getMcpName() + data.getSrgDescriptor())
);
this.mcpFieldData = buildMcpTypeData(
mcpMappingLoader.getCsvFieldData(),
mcpMappingLoader.getSrgFileData().class2FieldDataSet,
getConvertedMap(
FastReflectionForge.Fields.FMLDeobfuscatingRemapper_rawFieldMaps.get(FMLDeobfuscatingRemapper.INSTANCE),
str -> str.split(":")[0]
),
((csvData, data) -> csvData.getMcpName())
);
}
示例15: getRenamingMap
import com.google.common.collect.ImmutableBiMap; //導入方法依賴的package包/類
public ImmutableBiMap<String,String> getRenamingMap()
{
return ImmutableBiMap.copyOf(renamingMap);
}