com.google.common.reflect.TypeToken.capture()方法的使用及代码示例

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

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

TypeToken.capture介绍

暂无

代码示例

代码示例来源:origin: google/guava

/**
 * Constructs a new type token of {@code T}.
 *
 * <p>Clients create an empty anonymous subclass. Doing so embeds the type parameter in the
 * anonymous class's type hierarchy so we can reconstitute it at runtime despite erasure.
 *
 * <p>For example:
 *
 * <pre>{@code
 * TypeToken<List<String>> t = new TypeToken<List<String>>() {};
 * }</pre>
 */
protected TypeToken() {
 this.runtimeType = capture();
 checkState(
   !(runtimeType instanceof TypeVariable),
   "Cannot construct a TypeToken for a type variable.\n"
     + "You probably meant to call new TypeToken<%s>(getClass()) "
     + "that can resolve the type variable for you.\n"
     + "If you do need to create a TypeToken of a type variable, "
     + "please use TypeToken.of() instead.",
   runtimeType);
}

代码示例来源:origin: google/j2objc

/**
 * Constructs a new type token of {@code T}.
 *
 * <p>Clients create an empty anonymous subclass. Doing so embeds the type parameter in the
 * anonymous class's type hierarchy so we can reconstitute it at runtime despite erasure.
 *
 * <p>For example:
 *
 * <pre>{@code
 * TypeToken<List<String>> t = new TypeToken<List<String>>() {};
 * }</pre>
 */
protected TypeToken() {
 this.runtimeType = capture();
 checkState(
   !(runtimeType instanceof TypeVariable),
   "Cannot construct a TypeToken for a type variable.\n"
     + "You probably meant to call new TypeToken<%s>(getClass()) "
     + "that can resolve the type variable for you.\n"
     + "If you do need to create a TypeToken of a type variable, "
     + "please use TypeToken.of() instead.",
   runtimeType);
}

代码示例来源:origin: wildfly/wildfly

/**
 * Constructs a new type token of {@code T}.
 *
 * <p>Clients create an empty anonymous subclass. Doing so embeds the type parameter in the
 * anonymous class's type hierarchy so we can reconstitute it at runtime despite erasure.
 *
 * <p>For example:
 *
 * <pre>{@code
 * TypeToken<List<String>> t = new TypeToken<List<String>>() {};
 * }</pre>
 */
protected TypeToken() {
 this.runtimeType = capture();
 checkState(
   !(runtimeType instanceof TypeVariable),
   "Cannot construct a TypeToken for a type variable.\n"
     + "You probably meant to call new TypeToken<%s>(getClass()) "
     + "that can resolve the type variable for you.\n"
     + "If you do need to create a TypeToken of a type variable, "
     + "please use TypeToken.of() instead.",
   runtimeType);
}

代码示例来源:origin: com.google.guava/guava-jdk5

/**
 * Constructs a new type token of {@code T}.
 *
 * <p>Clients create an empty anonymous subclass. Doing so embeds the type
 * parameter in the anonymous class's type hierarchy so we can reconstitute
 * it at runtime despite erasure.
 *
 * <p>For example: <pre>   {@code
 *   TypeToken<List<String>> t = new TypeToken<List<String>>() {};}</pre>
 */
protected TypeToken() {
 this.runtimeType = capture();
 checkState(!(runtimeType instanceof TypeVariable),
   "Cannot construct a TypeToken for a type variable.\n" +
   "You probably meant to call new TypeToken<%s>(getClass()) " +
   "that can resolve the type variable for you.\n" +
   "If you do need to create a TypeToken of a type variable, " +
   "please use TypeToken.of() instead.", runtimeType);
}

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

/**
 * Constructs a new type token of {@code T}.
 *
 * <p>Clients create an empty anonymous subclass. Doing so embeds the type
 * parameter in the anonymous class's type hierarchy so we can reconstitute
 * it at runtime despite erasure.
 *
 * <p>For example: <pre>   {@code
 *   TypeToken<List<String>> t = new TypeToken<List<String>>() {};}</pre>
 */
protected TypeToken() {
 this.runtimeType = capture();
 checkState(!(runtimeType instanceof TypeVariable),
   "Cannot construct a TypeToken for a type variable.\n" +
   "You probably meant to call new TypeToken<%s>(getClass()) " +
   "that can resolve the type variable for you.\n" +
   "If you do need to create a TypeToken of a type variable, " +
   "please use TypeToken.of() instead.", runtimeType);
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

/**
 * Constructs a new type token of {@code T}.
 *
 * <p>Clients create an empty anonymous subclass. Doing so embeds the type
 * parameter in the anonymous class's type hierarchy so we can reconstitute
 * it at runtime despite erasure.
 *
 * <p>For example: <pre>   {@code
 *   TypeToken<List<String>> t = new TypeToken<List<String>>() {};}</pre>
 */
protected TypeToken() {
 this.runtimeType = capture();
 checkState(!(runtimeType instanceof TypeVariable),
   "Cannot construct a TypeToken for a type variable.\n" +
   "You probably meant to call new TypeToken<%s>(getClass()) " +
   "that can resolve the type variable for you.\n" +
   "If you do need to create a TypeToken of a type variable, " +
   "please use TypeToken.of() instead.", runtimeType);
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

/**
 * Constructs a new type token of {@code T}.
 *
 * <p>Clients create an empty anonymous subclass. Doing so embeds the type
 * parameter in the anonymous class's type hierarchy so we can reconstitute
 * it at runtime despite erasure.
 *
 * <p>For example: <pre>   {@code
 *   TypeToken<List<String>> t = new TypeToken<List<String>>() {};}</pre>
 */
protected TypeToken() {
 this.runtimeType = capture();
 checkState(!(runtimeType instanceof TypeVariable),
   "Cannot construct a TypeToken for a type variable.\n" +
   "You probably meant to call new TypeToken<%s>(getClass()) " +
   "that can resolve the type variable for you.\n" +
   "If you do need to create a TypeToken of a type variable, " +
   "please use TypeToken.of() instead.", runtimeType);
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

/**
 * Constructs a new type token of {@code T}.
 *
 * <p>Clients create an empty anonymous subclass. Doing so embeds the type
 * parameter in the anonymous class's type hierarchy so we can reconstitute
 * it at runtime despite erasure.
 *
 * <p>For example: <pre>   {@code
 *   TypeToken<List<String>> t = new TypeToken<List<String>>() {};}</pre>
 */
protected TypeToken() {
 this.runtimeType = capture();
 checkState(!(runtimeType instanceof TypeVariable),
   "Cannot construct a TypeToken for a type variable.\n" +
   "You probably meant to call new TypeToken<%s>(getClass()) " +
   "that can resolve the type variable for you.\n" +
   "If you do need to create a TypeToken of a type variable, " +
   "please use TypeToken.of() instead.", runtimeType);
}

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

/**
 * Constructs a new type token of {@code T}.
 *
 * <p>Clients create an empty anonymous subclass. Doing so embeds the type
 * parameter in the anonymous class's type hierarchy so we can reconstitute
 * it at runtime despite erasure.
 *
 * <p>For example: <pre>   {@code
 *   TypeToken<List<String>> t = new TypeToken<List<String>>() {};}</pre>
 */
protected TypeToken() {
 this.runtimeType = capture();
 checkState(!(runtimeType instanceof TypeVariable),
   "Cannot construct a TypeToken for a type variable.\n" +
   "You probably meant to call new TypeToken<%s>(getClass()) " +
   "that can resolve the type variable for you.\n" +
   "If you do need to create a TypeToken of a type variable, " +
   "please use TypeToken.of() instead.", runtimeType);
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

/**
 * Constructs a new type token of {@code T}.
 *
 * <p>Clients create an empty anonymous subclass. Doing so embeds the type parameter in the
 * anonymous class's type hierarchy so we can reconstitute it at runtime despite erasure.
 *
 * <p>For example:
 *
 * <pre>{@code
 * TypeToken<List<String>> t = new TypeToken<List<String>>() {};
 * }</pre>
 */
protected TypeToken() {
 this.runtimeType = capture();
 checkState(
   !(runtimeType instanceof TypeVariable),
   "Cannot construct a TypeToken for a type variable.\n"
     + "You probably meant to call new TypeToken<%s>(getClass()) "
     + "that can resolve the type variable for you.\n"
     + "If you do need to create a TypeToken of a type variable, "
     + "please use TypeToken.of() instead.",
   runtimeType);
}

代码示例来源:origin: org.hudsonci.lib.guava/guava

/**
 * Constructs a new type token of {@code T}.
 *
 * <p>Clients create an empty anonymous subclass. Doing so embeds the type
 * parameter in the anonymous class's type hierarchy so we can reconstitute
 * it at runtime despite erasure.
 *
 * <p>For example: <pre>   {@code
 *
 *   TypeToken<List<String>> t = new TypeToken<List<String>>() {};
 * }</pre>
 */
protected TypeToken() {
 this.runtimeType = capture();
 checkState(!(runtimeType instanceof TypeVariable),
   "Cannot construct a TypeToken for a type variable.\n" +
   "You probably meant to call new TypeToken<%s>(getClass()) " +
   "that can resolve the type variable for you.\n" +
   "If you do need to create a TypeToken of a type variable, " +
   "please use TypeToken.of() instead.", runtimeType);
}

代码示例来源:origin: org.kill-bill.billing/killbill-platform-osgi-bundles-logger

/**
 * Constructs a new type token of {@code T}.
 *
 * <p>Clients create an empty anonymous subclass. Doing so embeds the type parameter in the
 * anonymous class's type hierarchy so we can reconstitute it at runtime despite erasure.
 *
 * <p>For example:
 *
 * <pre>{@code
 * TypeToken<List<String>> t = new TypeToken<List<String>>() {};
 * }</pre>
 */
protected TypeToken() {
 this.runtimeType = capture();
 checkState(
   !(runtimeType instanceof TypeVariable),
   "Cannot construct a TypeToken for a type variable.\n"
     + "You probably meant to call new TypeToken<%s>(getClass()) "
     + "that can resolve the type variable for you.\n"
     + "If you do need to create a TypeToken of a type variable, "
     + "please use TypeToken.of() instead.",
   runtimeType);
}

相关文章

微信公众号

最新文章

更多

TypeToken类方法