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

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

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

Types.setOf介绍

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

代码示例

代码示例来源:origin: google/data-transfer-project

@SuppressWarnings("unchecked")
 public static final <T> TypeLiteral<Set<T>> setOf(Class<T> type) {
  return (TypeLiteral<Set<T>>) TypeLiteral.get(Types.setOf(type));
 }
}

代码示例来源:origin: apache/shiro

@SuppressWarnings({"unchecked"})
private Key<Set<Realm>> realmSetKey() {
  return (Key<Set<Realm>>) Key.get(TypeLiteral.get(Types.setOf(Realm.class)));
}

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

@SuppressWarnings("unchecked") // wrapping a T in a Set safely returns a Set<T>
static <T> TypeLiteral<Set<T>> setOf(TypeLiteral<T> elementType) {
 Type type = Types.setOf(elementType.getType());
 return (TypeLiteral<Set<T>>) TypeLiteral.get(type);
}

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

@SuppressWarnings("unchecked") // a provider entry <K, V> is safely a Map.Entry<K, Provider<V>>
static <K, V>
  TypeLiteral<Set<Map.Entry<K, javax.inject.Provider<V>>>> setOfEntryOfJavaxProviderOf(
    TypeLiteral<K> keyType, TypeLiteral<V> valueType) {
 return (TypeLiteral<Set<Map.Entry<K, javax.inject.Provider<V>>>>)
   TypeLiteral.get(Types.setOf(entryOfJavaxProviderOf(keyType, valueType).getType()));
}

代码示例来源:origin: jooby-project/jooby

/**
 * @param type The element type.
 * @param <T> Set type.
 * @return Get set of values when possible.
 */
@SuppressWarnings("unchecked")
@Nonnull
default <T> Set<T> toSet(final Class<T> type) {
 return (Set<T>) to(TypeLiteral.get(Types.setOf(Primitives.wrap(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, 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: 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: net.stickycode.configured/sticky-configured-guice3

@SuppressWarnings("unchecked")
 // wrapping a T in a Set safely returns a Set<T>
 static <T> TypeLiteral<Set<T>> setOf(TypeLiteral<T> elementType) {
  Type type = Types.setOf(elementType.getType());
  return (TypeLiteral<Set<T>>) TypeLiteral.get(type);
 }
}

代码示例来源:origin: net.stickycode.configured/sticky-configured-guice3

@SuppressWarnings("unchecked")
// wrapping a T in a Set safely returns a Set<T>
static <T> TypeLiteral<Set<T>> setOf(TypeLiteral<T> elementType) {
 Type type = Types.setOf(elementType.getType());
 return (TypeLiteral<Set<T>>) TypeLiteral.get(type);
}

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

@SuppressWarnings("unchecked") // wrapping a T in a Set safely returns a Set<T>
static <T> TypeLiteral<Set<T>> setOf(TypeLiteral<T> elementType) {
 Type type = Types.setOf(elementType.getType());
 return (TypeLiteral<Set<T>>) TypeLiteral.get(type);
}

代码示例来源:origin: org.xbib/guice

@SuppressWarnings("unchecked") // wrapping a T in a Set safely returns a Set<T>
static <T> TypeLiteral<Set<T>> setOf(TypeLiteral<T> elementType) {
  Type type = Types.setOf(elementType.getType());
  return (TypeLiteral<Set<T>>) TypeLiteral.get(type);
}

代码示例来源:origin: net.stickycode.bootstrap/sticky-bootstrap-guice3

@SuppressWarnings("unchecked")
 // wrapping a T in a Set safely returns a Set<T>
 static <T> TypeLiteral<Set<T>> setOf(TypeLiteral<T> elementType) {
  Type type = Types.setOf(elementType.getType());
  return (TypeLiteral<Set<T>>) TypeLiteral.get(type);
 }
}

代码示例来源:origin: Nextdoor/bender

@SuppressWarnings("unchecked") // wrapping a T in a Set safely returns a Set<T>
static <T> TypeLiteral<Set<T>> setOf(TypeLiteral<T> elementType) {
 Type type = Types.setOf(elementType.getType());
 return (TypeLiteral<Set<T>>) TypeLiteral.get(type);
}

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

@SuppressWarnings("unchecked") // wrapping a T in a Set safely returns a Set<T>
static <T> TypeLiteral<Set<T>> setOf(TypeLiteral<T> elementType) {
 Type type = Types.setOf(elementType.getType());
 return (TypeLiteral<Set<T>>) TypeLiteral.get(type);
}

代码示例来源:origin: org.jooby/jooby

/**
 * @param type The element type.
 * @param <T> Set type.
 * @return Get set of values when possible.
 */
@SuppressWarnings("unchecked")
@Nonnull
default <T> Set<T> toSet(final Class<T> type) {
 return (Set<T>) to(TypeLiteral.get(Types.setOf(Primitives.wrap(type))));
}

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

@SuppressWarnings("unchecked") // a provider entry <K, V> is safely a Map.Entry<K, Provider<V>>
static <K, V>
  TypeLiteral<Set<Map.Entry<K, javax.inject.Provider<V>>>> setOfEntryOfJavaxProviderOf(
    TypeLiteral<K> keyType, TypeLiteral<V> valueType) {
 return (TypeLiteral<Set<Map.Entry<K, javax.inject.Provider<V>>>>)
   TypeLiteral.get(Types.setOf(entryOfJavaxProviderOf(keyType, valueType).getType()));
}

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

@SuppressWarnings("unchecked") // a provider entry <K, V> is safely a Map.Entry<K, Provider<V>>
static <K, V>
  TypeLiteral<Set<Map.Entry<K, javax.inject.Provider<V>>>> setOfEntryOfJavaxProviderOf(
    TypeLiteral<K> keyType, TypeLiteral<V> valueType) {
 return (TypeLiteral<Set<Map.Entry<K, javax.inject.Provider<V>>>>)
   TypeLiteral.get(Types.setOf(entryOfJavaxProviderOf(keyType, 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.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()))));
}

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

相关文章