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

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

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

TypeToken.rejectTypeVariables介绍

[英]Ensures that this type token doesn't contain type variables, which can cause unchecked type errors for callers like TypeToInstanceMap.
[中]确保此类型标记不包含类型变量,这可能会导致调用方(如TypeToInstanceMap)出现未经检查的类型错误。

代码示例

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

/**
 * Associates {@code key} with {@code value} in the built map. Duplicate keys are not allowed,
 * and will cause {@link #build} to fail.
 */
@CanIgnoreReturnValue
public <T extends B> Builder<B> put(TypeToken<T> key, T value) {
 mapBuilder.put(key.rejectTypeVariables(), value);
 return this;
}

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

@Override
public <T extends B> T getInstance(TypeToken<T> type) {
 return trustedGet(type.rejectTypeVariables());
}

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

private static void assertNoTypeVariable(Type type) {
 TypeToken.of(type).rejectTypeVariables();
}

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

/**
 * Associates {@code key} with {@code value} in the built map. Duplicate keys are not allowed,
 * and will cause {@link #build} to fail.
 */
@CanIgnoreReturnValue
public <T extends B> Builder<B> put(TypeToken<T> key, T value) {
 mapBuilder.put(key.rejectTypeVariables(), value);
 return this;
}

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

@Override
public <T extends B> T getInstance(TypeToken<T> type) {
 return trustedGet(type.rejectTypeVariables());
}

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

@Override
public <T extends B> @Nullable T getInstance(TypeToken<T> type) {
 return trustedGet(type.rejectTypeVariables());
}

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

@Override
public <T extends B> T getInstance(TypeToken<T> type) {
 return trustedGet(type.rejectTypeVariables());
}

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

/**
 * Associates {@code key} with {@code value} in the built map. Duplicate keys are not allowed,
 * and will cause {@link #build} to fail.
 */
@CanIgnoreReturnValue
public <T extends B> Builder<B> put(TypeToken<T> key, T value) {
 mapBuilder.put(key.rejectTypeVariables(), value);
 return this;
}

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

@Override
@NullableDecl
public <T extends B> T getInstance(TypeToken<T> type) {
 return trustedGet(type.rejectTypeVariables());
}

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

private static void assertHasTypeVariable(Type type) {
 try {
  TypeToken.of(type).rejectTypeVariables();
  fail("Should contain TypeVariable");
 } catch (IllegalArgumentException expected) {
 }
}

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

@NullableDecl
@Override
public <T extends B> T getInstance(TypeToken<T> type) {
 return trustedGet(type.rejectTypeVariables());
}

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

@Override
@CanIgnoreReturnValue
public <T extends B> @Nullable T putInstance(TypeToken<T> type, @Nullable T value) {
 return trustedPut(type.rejectTypeVariables(), value);
}

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

@Override
@CanIgnoreReturnValue
@NullableDecl
public <T extends B> T putInstance(TypeToken<T> type, @NullableDecl T value) {
 return trustedPut(type.rejectTypeVariables(), value);
}

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

@NullableDecl
@Override
@CanIgnoreReturnValue
public <T extends B> T putInstance(TypeToken<T> type, @NullableDecl T value) {
 return trustedPut(type.rejectTypeVariables(), value);
}

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

/**
 * Associates {@code key} with {@code value} in the built map. Duplicate
 * keys are not allowed, and will cause {@link #build} to fail.
 */
public <T extends B> Builder<B> put(TypeToken<T> key, T value) {
 mapBuilder.put(key.rejectTypeVariables(), value);
 return this;
}

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

/**
 * Associates {@code key} with {@code value} in the built map. Duplicate
 * keys are not allowed, and will cause {@link #build} to fail.
 */
public <T extends B> Builder<B> put(TypeToken<T> key, T value) {
 mapBuilder.put(key.rejectTypeVariables(), value);
 return this;
}

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

@Nullable
@Override
public <T extends B> T getInstance(TypeToken<T> type) {
 return trustedGet(type.rejectTypeVariables());
}

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

@Nullable
@Override
public <T extends B> T putInstance(TypeToken<T> type, @Nullable T value) {
 return trustedPut(type.rejectTypeVariables(), value);
}

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

@Nullable
@Override
public <T extends B> T getInstance(TypeToken<T> type) {
 return trustedGet(type.rejectTypeVariables());
}

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

@NullableDecl
@Override
public <T extends B> T getInstance(TypeToken<T> type) {
 return trustedGet(type.rejectTypeVariables());
}

相关文章

微信公众号

最新文章

更多

TypeToken类方法