com.google.inject.TypeLiteral.resolveAll()方法的使用及代码示例

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

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

TypeLiteral.resolveAll介绍

[英]Returns an immutable list of the resolved types.
[中]返回已解析类型的不可变列表。

代码示例

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

/**
 * Returns the resolved generic parameter types of {@code methodOrConstructor}.
 *
 * @param methodOrConstructor a method or constructor defined by this or any supertype.
 * @since 2.0
 */
public List<TypeLiteral<?>> getParameterTypes(Member methodOrConstructor) {
 Type[] genericParameterTypes;
 if (methodOrConstructor instanceof Method) {
  Method method = (Method) methodOrConstructor;
  checkArgument(
    method.getDeclaringClass().isAssignableFrom(rawType),
    "%s is not defined by a supertype of %s",
    method,
    type);
  genericParameterTypes = method.getGenericParameterTypes();
 } else if (methodOrConstructor instanceof Constructor) {
  Constructor<?> constructor = (Constructor<?>) methodOrConstructor;
  checkArgument(
    constructor.getDeclaringClass().isAssignableFrom(rawType),
    "%s does not construct a supertype of %s",
    constructor,
    type);
  genericParameterTypes = constructor.getGenericParameterTypes();
 } else {
  throw new IllegalArgumentException("Not a method or a constructor: " + methodOrConstructor);
 }
 return resolveAll(genericParameterTypes);
}

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

/**
 * Returns the resolved generic exception types thrown by {@code constructor}.
 *
 * @param methodOrConstructor a method or constructor defined by this or any supertype.
 * @since 2.0
 */
public List<TypeLiteral<?>> getExceptionTypes(Member methodOrConstructor) {
 Type[] genericExceptionTypes;
 if (methodOrConstructor instanceof Method) {
  Method method = (Method) methodOrConstructor;
  checkArgument(
    method.getDeclaringClass().isAssignableFrom(rawType),
    "%s is not defined by a supertype of %s",
    method,
    type);
  genericExceptionTypes = method.getGenericExceptionTypes();
 } else if (methodOrConstructor instanceof Constructor) {
  Constructor<?> constructor = (Constructor<?>) methodOrConstructor;
  checkArgument(
    constructor.getDeclaringClass().isAssignableFrom(rawType),
    "%s does not construct a supertype of %s",
    constructor,
    type);
  genericExceptionTypes = constructor.getGenericExceptionTypes();
 } else {
  throw new IllegalArgumentException("Not a method or a constructor: " + methodOrConstructor);
 }
 return resolveAll(genericExceptionTypes);
}

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

/**
 * Returns the resolved generic parameter types of {@code methodOrConstructor}.
 *
 * @param methodOrConstructor a method or constructor defined by this or any supertype.
 */
public List<TypeLiteral<?>> getParameterTypes(Member methodOrConstructor) {
  Type[] genericParameterTypes;
  if (methodOrConstructor instanceof Method) {
    Method method = (Method) methodOrConstructor;
    checkArgument(method.getDeclaringClass().isAssignableFrom(rawType),
        "%s is not defined by a supertype of %s", method, type);
    genericParameterTypes = method.getGenericParameterTypes();
  } else if (methodOrConstructor instanceof Constructor) {
    Constructor<?> constructor = (Constructor<?>) methodOrConstructor;
    checkArgument(constructor.getDeclaringClass().isAssignableFrom(rawType),
        "%s does not construct a supertype of %s", constructor, type);
    genericParameterTypes = constructor.getGenericParameterTypes();
  } else {
    throw new IllegalArgumentException("Not a method or a constructor: " + methodOrConstructor);
  }
  return resolveAll(genericParameterTypes);
}

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

/**
 * Returns the resolved generic parameter types of {@code methodOrConstructor}.
 *
 * @param methodOrConstructor a method or constructor defined by this or any supertype.
 * @since 2.0
 */
public List<TypeLiteral<?>> getParameterTypes(Member methodOrConstructor) {
 Type[] genericParameterTypes;
 if (methodOrConstructor instanceof Method) {
  Method method = (Method) methodOrConstructor;
  checkArgument(
    method.getDeclaringClass().isAssignableFrom(rawType),
    "%s is not defined by a supertype of %s",
    method,
    type);
  genericParameterTypes = method.getGenericParameterTypes();
 } else if (methodOrConstructor instanceof Constructor) {
  Constructor<?> constructor = (Constructor<?>) methodOrConstructor;
  checkArgument(
    constructor.getDeclaringClass().isAssignableFrom(rawType),
    "%s does not construct a supertype of %s",
    constructor,
    type);
  genericParameterTypes = constructor.getGenericParameterTypes();
 } else {
  throw new IllegalArgumentException("Not a method or a constructor: " + methodOrConstructor);
 }
 return resolveAll(genericParameterTypes);
}

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

/**
 * Returns the resolved generic parameter types of {@code methodOrConstructor}.
 *
 * @param methodOrConstructor a method or constructor defined by this or any supertype.
 * @since 2.0
 */
public List<TypeLiteral<?>> getParameterTypes(Member methodOrConstructor) {
 Type[] genericParameterTypes;
 if (methodOrConstructor instanceof Method) {
  Method method = (Method) methodOrConstructor;
  checkArgument(
    method.getDeclaringClass().isAssignableFrom(rawType),
    "%s is not defined by a supertype of %s",
    method,
    type);
  genericParameterTypes = method.getGenericParameterTypes();
 } else if (methodOrConstructor instanceof Constructor) {
  Constructor<?> constructor = (Constructor<?>) methodOrConstructor;
  checkArgument(
    constructor.getDeclaringClass().isAssignableFrom(rawType),
    "%s does not construct a supertype of %s",
    constructor,
    type);
  genericParameterTypes = constructor.getGenericParameterTypes();
 } else {
  throw new IllegalArgumentException("Not a method or a constructor: " + methodOrConstructor);
 }
 return resolveAll(genericParameterTypes);
}

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

/**
 * Returns the resolved generic exception types thrown by {@code constructor}.
 *
 * @param methodOrConstructor a method or constructor defined by this or any supertype.
 */
public List<TypeLiteral<?>> getExceptionTypes(Member methodOrConstructor) {
  Type[] genericExceptionTypes;
  if (methodOrConstructor instanceof Method) {
    Method method = (Method) methodOrConstructor;
    checkArgument(method.getDeclaringClass().isAssignableFrom(rawType),
        "%s is not defined by a supertype of %s", method, type);
    genericExceptionTypes = method.getGenericExceptionTypes();
  } else if (methodOrConstructor instanceof Constructor) {
    Constructor<?> constructor = (Constructor<?>) methodOrConstructor;
    checkArgument(constructor.getDeclaringClass().isAssignableFrom(rawType),
        "%s does not construct a supertype of %s", constructor, type);
    genericExceptionTypes = constructor.getGenericExceptionTypes();
  } else {
    throw new IllegalArgumentException("Not a method or a constructor: " + methodOrConstructor);
  }
  return resolveAll(genericExceptionTypes);
}

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

/**
 * Returns the resolved generic parameter types of {@code methodOrConstructor}.
 *
 * @param methodOrConstructor a method or constructor defined by this or any supertype.
 * @since 2.0
 */
public List<TypeLiteral<?>> getParameterTypes(Member methodOrConstructor) {
 Type[] genericParameterTypes;
 if (methodOrConstructor instanceof Method) {
  Method method = (Method) methodOrConstructor;
  checkArgument(method.getDeclaringClass().isAssignableFrom(rawType),
    "%s is not defined by a supertype of %s", method, type);
  genericParameterTypes = method.getGenericParameterTypes();
 } else if (methodOrConstructor instanceof Constructor) {
  Constructor<?> constructor = (Constructor<?>) methodOrConstructor;
  checkArgument(constructor.getDeclaringClass().isAssignableFrom(rawType),
    "%s does not construct a supertype of %s", constructor, type);
  genericParameterTypes = constructor.getGenericParameterTypes();
 } else {
  throw new IllegalArgumentException("Not a method or a constructor: " + methodOrConstructor);
 }
 return resolveAll(genericParameterTypes);
}

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

/**
 * Returns the resolved generic parameter types of {@code methodOrConstructor}.
 *
 * @param methodOrConstructor a method or constructor defined by this or any supertype.
 * @since 2.0
 */
public List<TypeLiteral<?>> getParameterTypes(Member methodOrConstructor) {
 Type[] genericParameterTypes;
 if (methodOrConstructor instanceof Method) {
  Method method = (Method) methodOrConstructor;
  checkArgument(method.getDeclaringClass().isAssignableFrom(rawType),
    "%s is not defined by a supertype of %s", method, type);
  genericParameterTypes = method.getGenericParameterTypes();
 } else if (methodOrConstructor instanceof Constructor) {
  Constructor<?> constructor = (Constructor<?>) methodOrConstructor;
  checkArgument(constructor.getDeclaringClass().isAssignableFrom(rawType),
    "%s does not construct a supertype of %s", constructor, type);
  genericParameterTypes = constructor.getGenericParameterTypes();
 } else {
  throw new IllegalArgumentException("Not a method or a constructor: " + methodOrConstructor);
 }
 return resolveAll(genericParameterTypes);
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.google.inject

/**
 * Returns the resolved generic parameter types of {@code methodOrConstructor}.
 *
 * @param methodOrConstructor a method or constructor defined by this or any supertype.
 * @since 2.0
 */
public List<TypeLiteral<?>> getParameterTypes(Member methodOrConstructor) {
 Type[] genericParameterTypes;
 if (methodOrConstructor instanceof Method) {
  Method method = (Method) methodOrConstructor;
  checkArgument(method.getDeclaringClass().isAssignableFrom(rawType),
    "%s is not defined by a supertype of %s", method, type);
  genericParameterTypes = method.getGenericParameterTypes();
 } else if (methodOrConstructor instanceof Constructor) {
  Constructor<?> constructor = (Constructor<?>) methodOrConstructor;
  checkArgument(constructor.getDeclaringClass().isAssignableFrom(rawType),
    "%s does not construct a supertype of %s", constructor, type);
  genericParameterTypes = constructor.getGenericParameterTypes();
 } else {
  throw new IllegalArgumentException("Not a method or a constructor: " + methodOrConstructor);
 }
 return resolveAll(genericParameterTypes);
}

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

/**
 * Returns the resolved generic exception types thrown by {@code constructor}.
 *
 * @param methodOrConstructor a method or constructor defined by this or any supertype.
 * @since 2.0
 */
public List<TypeLiteral<?>> getExceptionTypes(Member methodOrConstructor) {
 Type[] genericExceptionTypes;
 if (methodOrConstructor instanceof Method) {
  Method method = (Method) methodOrConstructor;
  checkArgument(
    method.getDeclaringClass().isAssignableFrom(rawType),
    "%s is not defined by a supertype of %s",
    method,
    type);
  genericExceptionTypes = method.getGenericExceptionTypes();
 } else if (methodOrConstructor instanceof Constructor) {
  Constructor<?> constructor = (Constructor<?>) methodOrConstructor;
  checkArgument(
    constructor.getDeclaringClass().isAssignableFrom(rawType),
    "%s does not construct a supertype of %s",
    constructor,
    type);
  genericExceptionTypes = constructor.getGenericExceptionTypes();
 } else {
  throw new IllegalArgumentException("Not a method or a constructor: " + methodOrConstructor);
 }
 return resolveAll(genericExceptionTypes);
}

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

/**
 * Returns the resolved generic exception types thrown by {@code constructor}.
 *
 * @param methodOrConstructor a method or constructor defined by this or any supertype.
 * @since 2.0
 */
public List<TypeLiteral<?>> getExceptionTypes(Member methodOrConstructor) {
 Type[] genericExceptionTypes;
 if (methodOrConstructor instanceof Method) {
  Method method = (Method) methodOrConstructor;
  checkArgument(
    method.getDeclaringClass().isAssignableFrom(rawType),
    "%s is not defined by a supertype of %s",
    method,
    type);
  genericExceptionTypes = method.getGenericExceptionTypes();
 } else if (methodOrConstructor instanceof Constructor) {
  Constructor<?> constructor = (Constructor<?>) methodOrConstructor;
  checkArgument(
    constructor.getDeclaringClass().isAssignableFrom(rawType),
    "%s does not construct a supertype of %s",
    constructor,
    type);
  genericExceptionTypes = constructor.getGenericExceptionTypes();
 } else {
  throw new IllegalArgumentException("Not a method or a constructor: " + methodOrConstructor);
 }
 return resolveAll(genericExceptionTypes);
}

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

/**
 * Returns the resolved generic exception types thrown by {@code constructor}.
 *
 * @param methodOrConstructor a method or constructor defined by this or any supertype.
 * @since 2.0
 */
public List<TypeLiteral<?>> getExceptionTypes(Member methodOrConstructor) {
 Type[] genericExceptionTypes;
 if (methodOrConstructor instanceof Method) {
  Method method = (Method) methodOrConstructor;
  checkArgument(method.getDeclaringClass().isAssignableFrom(rawType),
    "%s is not defined by a supertype of %s", method, type);
  genericExceptionTypes = method.getGenericExceptionTypes();
 } else if (methodOrConstructor instanceof Constructor) {
  Constructor<?> constructor = (Constructor<?>) methodOrConstructor;
  checkArgument(constructor.getDeclaringClass().isAssignableFrom(rawType),
    "%s does not construct a supertype of %s", constructor, type);
  genericExceptionTypes = constructor.getGenericExceptionTypes();
 } else {
  throw new IllegalArgumentException("Not a method or a constructor: " + methodOrConstructor);
 }
 return resolveAll(genericExceptionTypes);
}

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

/**
 * Returns the resolved generic exception types thrown by {@code constructor}.
 *
 * @param methodOrConstructor a method or constructor defined by this or any supertype.
 * @since 2.0
 */
public List<TypeLiteral<?>> getExceptionTypes(Member methodOrConstructor) {
 Type[] genericExceptionTypes;
 if (methodOrConstructor instanceof Method) {
  Method method = (Method) methodOrConstructor;
  checkArgument(method.getDeclaringClass().isAssignableFrom(rawType),
    "%s is not defined by a supertype of %s", method, type);
  genericExceptionTypes = method.getGenericExceptionTypes();
 } else if (methodOrConstructor instanceof Constructor) {
  Constructor<?> constructor = (Constructor<?>) methodOrConstructor;
  checkArgument(constructor.getDeclaringClass().isAssignableFrom(rawType),
    "%s does not construct a supertype of %s", constructor, type);
  genericExceptionTypes = constructor.getGenericExceptionTypes();
 } else {
  throw new IllegalArgumentException("Not a method or a constructor: " + methodOrConstructor);
 }
 return resolveAll(genericExceptionTypes);
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.google.inject

/**
 * Returns the resolved generic exception types thrown by {@code constructor}.
 *
 * @param methodOrConstructor a method or constructor defined by this or any supertype.
 * @since 2.0
 */
public List<TypeLiteral<?>> getExceptionTypes(Member methodOrConstructor) {
 Type[] genericExceptionTypes;
 if (methodOrConstructor instanceof Method) {
  Method method = (Method) methodOrConstructor;
  checkArgument(method.getDeclaringClass().isAssignableFrom(rawType),
    "%s is not defined by a supertype of %s", method, type);
  genericExceptionTypes = method.getGenericExceptionTypes();
 } else if (methodOrConstructor instanceof Constructor) {
  Constructor<?> constructor = (Constructor<?>) methodOrConstructor;
  checkArgument(constructor.getDeclaringClass().isAssignableFrom(rawType),
    "%s does not construct a supertype of %s", constructor, type);
  genericExceptionTypes = constructor.getGenericExceptionTypes();
 } else {
  throw new IllegalArgumentException("Not a method or a constructor: " + methodOrConstructor);
 }
 return resolveAll(genericExceptionTypes);
}

相关文章