com.google.inject.util.Types.collectionOf()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(96)

本文整理了Java中com.google.inject.util.Types.collectionOf()方法的一些代码示例,展示了Types.collectionOf()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Types.collectionOf()方法的具体详情如下:
包路径:com.google.inject.util.Types
类名称:Types
方法名:collectionOf

Types.collectionOf介绍

[英]Returns a type modelling a Collection whose elements are of type elementType.
[中]返回一个为集合建模的类型,该集合的元素类型为elementType。

代码示例

代码示例来源:origin: com.google.inject/guice

@SuppressWarnings("unchecked")
static <T> TypeLiteral<Collection<Provider<T>>> collectionOfProvidersOf(
  TypeLiteral<T> elementType) {
 Type providerType = Types.providerOf(elementType.getType());
 Type type = Types.collectionOf(providerType);
 return (TypeLiteral<Collection<Provider<T>>>) TypeLiteral.get(type);
}

代码示例来源:origin: com.google.inject/guice

@SuppressWarnings("unchecked")
static <T> TypeLiteral<Collection<javax.inject.Provider<T>>> collectionOfJavaxProvidersOf(
  TypeLiteral<T> elementType) {
 Type providerType =
   Types.newParameterizedType(javax.inject.Provider.class, elementType.getType());
 Type type = Types.collectionOf(providerType);
 return (TypeLiteral<Collection<javax.inject.Provider<T>>>) TypeLiteral.get(type);
}

代码示例来源: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, 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.jwebmp.inject/guice

@SuppressWarnings("unchecked")
static <T> TypeLiteral<Collection<Provider<T>>> collectionOfProvidersOf(
  TypeLiteral<T> elementType) {
 Type providerType = Types.providerOf(elementType.getType());
 Type type = Types.collectionOf(providerType);
 return (TypeLiteral<Collection<Provider<T>>>) TypeLiteral.get(type);
}

代码示例来源:origin: org.sonatype.sisu/sisu-guice

@SuppressWarnings("unchecked")
static <T> TypeLiteral<Collection<Provider<T>>> collectionOfProvidersOf(
  TypeLiteral<T> elementType) {
 Type providerType = Types.providerOf(elementType.getType());
 Type type = Types.collectionOf(providerType);
 return (TypeLiteral<Collection<Provider<T>>>) TypeLiteral.get(type);
}

代码示例来源:origin: org.sonatype.sisu/sisu-guice

@SuppressWarnings("unchecked")
static <T> TypeLiteral<Collection<javax.inject.Provider<T>>> collectionOfJavaxProvidersOf(
  TypeLiteral<T> elementType) {
 Type providerType =
   Types.newParameterizedType(javax.inject.Provider.class, elementType.getType());
 Type type = Types.collectionOf(providerType);
 return (TypeLiteral<Collection<javax.inject.Provider<T>>>) TypeLiteral.get(type);
}

代码示例来源:origin: com.jwebmp.inject/guice

@SuppressWarnings("unchecked")
static <T> TypeLiteral<Collection<javax.inject.Provider<T>>> collectionOfJavaxProvidersOf(
  TypeLiteral<T> elementType) {
 Type providerType =
   Types.newParameterizedType(javax.inject.Provider.class, elementType.getType());
 Type type = Types.collectionOf(providerType);
 return (TypeLiteral<Collection<javax.inject.Provider<T>>>) TypeLiteral.get(type);
}

代码示例来源:origin: com.simplyti.cloud/simple-server-core

@SuppressWarnings("unchecked")
public TypedRequestFinishableApiBuilder<Collection<FileUpload>, Object> asFileUplod() {
  return new TypedRequestFinishableApiBuilder<>(builder,method,uri,TypeLiteral.create(Types.collectionOf(FileUpload.class)),
      true, maxBodyLength);
}

代码示例来源: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<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: 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: com.jwebmp.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.jwebmp.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()))));
}

相关文章