org.jvnet.tiger_types.Types.fix()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(81)

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

Types.fix介绍

[英]JDK 5.0 has a bug of createing GenericArrayType where it shouldn't. fix that manually to work around the problem. See bug 6202725.
[中]JDK 5.0在不应该创建GenericarArrayType的地方存在一个错误。请手动修复该错误以解决该问题。见错误6202725。

代码示例

代码示例来源:origin: javaee/glassfish

/**
 * Gets the i-th type argument from a parameterized type.
 *
 * <p>
 * For example, {@code getTypeArgument([Map<Integer,String>],0)=Integer}
 * If the given type is not a parameterized type, returns the specified
 * default value.
 *
 * <p>
 * This is convenient for handling raw types and parameterized types uniformly.
 *
 * @throws IndexOutOfBoundsException
 *      If i is out of range.
 */
public static Type getTypeArgument(Type type, int i, Type defaultValue) {
  if (type instanceof ParameterizedType) {
    ParameterizedType p = (ParameterizedType) type;
    return fix(p.getActualTypeArguments()[i]);
  } else
    return defaultValue;
}

代码示例来源:origin: eclipse-ee4j/glassfish

/**
 * Gets the i-th type argument from a parameterized type.
 *
 * <p>
 * For example, {@code getTypeArgument([Map<Integer,String>],0)=Integer}
 * If the given type is not a parameterized type, returns the specified
 * default value.
 *
 * <p>
 * This is convenient for handling raw types and parameterized types uniformly.
 *
 * @throws IndexOutOfBoundsException
 *      If i is out of range.
 */
public static Type getTypeArgument(Type type, int i, Type defaultValue) {
  if (type instanceof ParameterizedType) {
    ParameterizedType p = (ParameterizedType) type;
    return fix(p.getActualTypeArguments()[i]);
  } else
    return defaultValue;
}

代码示例来源:origin: org.jvnet/tiger-types

/**
 * Gets the i-th type argument from a parameterized type.
 *
 * <p>
 * For example, {@code getTypeArgument([Map<Integer,String>],0)=Integer}
 * If the given type is not a parameterized type, returns the specified
 * default value.
 *
 * <p>
 * This is convenient for handling raw types and parameterized types uniformly.
 *
 * @throws IndexOutOfBoundsException
 *      If i is out of range.
 */
public static Type getTypeArgument(Type type, int i, Type defaultValue) {
  if (type instanceof ParameterizedType) {
    ParameterizedType p = (ParameterizedType) type;
    return fix(p.getActualTypeArguments()[i]);
  } else
    return defaultValue;
}

相关文章