本文整理了Java中com.google.inject.util.Types.mapOf()
方法的一些代码示例,展示了Types.mapOf()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Types.mapOf()
方法的具体详情如下:
包路径:com.google.inject.util.Types
类名称:Types
方法名:mapOf
[英]Returns a type modelling a Map whose keys are of type keyType and whose values are of type valueType.
[中]返回一个映射的类型,该映射的键为keyType类型,值为valueType类型。
代码示例来源:origin: com.google.inject/guice
@SuppressWarnings("unchecked") // a map of <K, V> is safely a Map<K, V>
static <K, V> TypeLiteral<Map<K, V>> mapOf(TypeLiteral<K> keyType, TypeLiteral<V> valueType) {
return (TypeLiteral<Map<K, V>>)
TypeLiteral.get(Types.mapOf(keyType.getType(), valueType.getType()));
}
代码示例来源:origin: com.google.inject/guice
@SuppressWarnings("unchecked") // a provider map <K, V> is safely a Map<K, Provider<V>>
static <K, V> TypeLiteral<Map<K, Provider<V>>> mapOfProviderOf(
TypeLiteral<K> keyType, TypeLiteral<V> valueType) {
return (TypeLiteral<Map<K, Provider<V>>>)
TypeLiteral.get(Types.mapOf(keyType.getType(), Types.providerOf(valueType.getType())));
}
代码示例来源:origin: com.google.inject/guice
@SuppressWarnings("unchecked")
static <K, V> TypeLiteral<Map<K, javax.inject.Provider<V>>> mapOfJavaxProviderOf(
TypeLiteral<K> keyType, TypeLiteral<V> valueType) {
return (TypeLiteral<Map<K, javax.inject.Provider<V>>>)
TypeLiteral.get(
Types.mapOf(
keyType.getType(),
newParameterizedType(javax.inject.Provider.class, valueType.getType())));
}
代码示例来源:origin: com.google.inject/guice
@SuppressWarnings("unchecked") // a provider map <K, Set<V>> is safely a Map<K, Set<Provider<V>>>
static <K, V> TypeLiteral<Map<K, Collection<Provider<V>>>> mapOfCollectionOfProviderOf(
TypeLiteral<K> keyType, TypeLiteral<V> valueType) {
return (TypeLiteral<Map<K, Collection<Provider<V>>>>)
TypeLiteral.get(
Types.mapOf(
keyType.getType(), Types.collectionOf(Types.providerOf(valueType.getType()))));
}
代码示例来源:origin: com.google.inject/guice
@SuppressWarnings("unchecked") // a provider map <K, Set<V>> is safely a Map<K, Set<Provider<V>>>
static <K, V>
TypeLiteral<Map<K, Collection<javax.inject.Provider<V>>>> mapOfCollectionOfJavaxProviderOf(
TypeLiteral<K> keyType, TypeLiteral<V> valueType) {
return (TypeLiteral<Map<K, Collection<javax.inject.Provider<V>>>>)
TypeLiteral.get(
Types.mapOf(
keyType.getType(), Types.collectionOf(Types.javaxProviderOf(valueType.getType()))));
}
代码示例来源:origin: com.google.inject/guice
@SuppressWarnings("unchecked") // a provider map <K, Set<V>> is safely a Map<K, Set<Provider<V>>>
static <K, V> TypeLiteral<Map<K, Set<javax.inject.Provider<V>>>> mapOfSetOfJavaxProviderOf(
TypeLiteral<K> keyType, TypeLiteral<V> valueType) {
return (TypeLiteral<Map<K, Set<javax.inject.Provider<V>>>>)
TypeLiteral.get(
Types.mapOf(
keyType.getType(), Types.setOf(Types.javaxProviderOf(valueType.getType()))));
}
代码示例来源:origin: com.google.inject/guice
@SuppressWarnings("unchecked") // a provider map <K, Set<V>> is safely a Map<K, Set<Provider<V>>>
static <K, V> TypeLiteral<Map<K, Set<Provider<V>>>> mapOfSetOfProviderOf(
TypeLiteral<K> keyType, TypeLiteral<V> valueType) {
return (TypeLiteral<Map<K, Set<Provider<V>>>>)
TypeLiteral.get(
Types.mapOf(keyType.getType(), Types.setOf(Types.providerOf(valueType.getType()))));
}
代码示例来源:origin: apache/incubator-druid
public T get()
final ParameterizedType mapType = Types.mapOf(
String.class, Types.newParameterizedType(Provider.class, key.getTypeLiteral().getType())
);
代码示例来源:origin: org.sonatype.sisu/sisu-guice
@SuppressWarnings("unchecked") // a map of <K, V> is safely a Map<K, V>
static <K, V> TypeLiteral<Map<K, V>> mapOf(TypeLiteral<K> keyType, TypeLiteral<V> valueType) {
return (TypeLiteral<Map<K, V>>)
TypeLiteral.get(Types.mapOf(keyType.getType(), valueType.getType()));
}
代码示例来源:origin: com.jwebmp.inject/guice
@SuppressWarnings("unchecked") // a map of <K, V> is safely a Map<K, V>
static <K, V> TypeLiteral<Map<K, V>> mapOf(TypeLiteral<K> keyType, TypeLiteral<V> valueType) {
return (TypeLiteral<Map<K, V>>)
TypeLiteral.get(Types.mapOf(keyType.getType(), valueType.getType()));
}
代码示例来源:origin: org.sonatype.sisu/sisu-guice
@SuppressWarnings("unchecked") // a provider map <K, V> is safely a Map<K, Provider<V>>
static <K, V> TypeLiteral<Map<K, Provider<V>>> mapOfProviderOf(
TypeLiteral<K> keyType, TypeLiteral<V> valueType) {
return (TypeLiteral<Map<K, Provider<V>>>)
TypeLiteral.get(Types.mapOf(keyType.getType(), Types.providerOf(valueType.getType())));
}
代码示例来源:origin: org.xbib/guice
@SuppressWarnings("unchecked")
static <K, V> TypeLiteral<Map<K, javax.inject.Provider<V>>> mapOfJavaxProviderOf(
TypeLiteral<K> keyType, TypeLiteral<V> valueType) {
return (TypeLiteral<Map<K, javax.inject.Provider<V>>>) TypeLiteral.get(
Types.mapOf(keyType.getType(),
newParameterizedType(javax.inject.Provider.class, valueType.getType())));
}
代码示例来源:origin: com.jwebmp.inject/guice
@SuppressWarnings("unchecked")
static <K, V> TypeLiteral<Map<K, javax.inject.Provider<V>>> mapOfJavaxProviderOf(
TypeLiteral<K> keyType, TypeLiteral<V> valueType) {
return (TypeLiteral<Map<K, javax.inject.Provider<V>>>)
TypeLiteral.get(
Types.mapOf(
keyType.getType(),
newParameterizedType(javax.inject.Provider.class, valueType.getType())));
}
代码示例来源:origin: org.xbib/guice
@SuppressWarnings("unchecked") // a provider map <K, V> is safely a Map<K, Provider<V>>
static <K, V> TypeLiteral<Map<K, Provider<V>>> mapOfProviderOf(
TypeLiteral<K> keyType, TypeLiteral<V> valueType) {
return (TypeLiteral<Map<K, Provider<V>>>) TypeLiteral.get(
Types.mapOf(keyType.getType(), Types.providerOf(valueType.getType())));
}
代码示例来源:origin: org.sonatype.sisu/sisu-guice
@SuppressWarnings("unchecked") // a provider map <K, Set<V>> is safely a Map<K, Set<Provider<V>>>
static <K, V> TypeLiteral<Map<K, Set<javax.inject.Provider<V>>>> mapOfSetOfJavaxProviderOf(
TypeLiteral<K> keyType, TypeLiteral<V> valueType) {
return (TypeLiteral<Map<K, Set<javax.inject.Provider<V>>>>)
TypeLiteral.get(
Types.mapOf(
keyType.getType(), Types.setOf(Types.javaxProviderOf(valueType.getType()))));
}
代码示例来源:origin: org.sonatype.sisu/sisu-guice
@SuppressWarnings("unchecked") // a provider map <K, Set<V>> is safely a Map<K, Set<Provider<V>>>
static <K, V> TypeLiteral<Map<K, Set<Provider<V>>>> mapOfSetOfProviderOf(
TypeLiteral<K> keyType, TypeLiteral<V> valueType) {
return (TypeLiteral<Map<K, Set<Provider<V>>>>)
TypeLiteral.get(
Types.mapOf(keyType.getType(), Types.setOf(Types.providerOf(valueType.getType()))));
}
代码示例来源:origin: org.sonatype.sisu/sisu-guice
@SuppressWarnings("unchecked") // a provider map <K, Set<V>> is safely a Map<K, Set<Provider<V>>>
static <K, V>
TypeLiteral<Map<K, Collection<javax.inject.Provider<V>>>> mapOfCollectionOfJavaxProviderOf(
TypeLiteral<K> keyType, TypeLiteral<V> valueType) {
return (TypeLiteral<Map<K, Collection<javax.inject.Provider<V>>>>)
TypeLiteral.get(
Types.mapOf(
keyType.getType(), Types.collectionOf(Types.javaxProviderOf(valueType.getType()))));
}
代码示例来源:origin: org.eclipse.sisu/org.eclipse.sisu.inject.tests
public void testPropertyType()
{
final Iterator<BeanProperty<Object>> i = new BeanProperties( G.class ).iterator();
assertEquals( TypeLiteral.get( Types.mapOf( BigDecimal.class, Float.class ) ), i.next().getType() );
assertEquals( TypeLiteral.get( Types.listOf( String.class ) ), i.next().getType() );
}
代码示例来源:origin: org.xbib/guice
@SuppressWarnings("unchecked") // a provider map <K, Set<V>> is safely a Map<K, Set<Provider<V>>>
static <K, V> TypeLiteral<Map<K, Set<Provider<V>>>> mapOfSetOfProviderOf(
TypeLiteral<K> keyType, TypeLiteral<V> valueType) {
return (TypeLiteral<Map<K, Set<Provider<V>>>>) TypeLiteral.get(
Types.mapOf(keyType.getType(), Types.setOf(Types.providerOf(valueType.getType()))));
}
代码示例来源:origin: org.jclouds.api/chef
@SuppressWarnings("unchecked")
// a provider map <K, Set<V>> is safely a Map<K, Set<Provider<V>>>
private static <K, V> TypeLiteral<Map<K, Set<Provider<V>>>> mapOfSetOfProviderOf(TypeLiteral<K> keyType,
TypeLiteral<V> valueType) {
return (TypeLiteral<Map<K, Set<Provider<V>>>>) TypeLiteral.get(Types.mapOf(keyType.getType(),
Types.setOf(Types.providerOf(valueType.getType()))));
}
内容来源于网络,如有侵权,请联系作者删除!