本文整理汇总了Java中javax.annotation.ParametersAreNonnullByDefault类的典型用法代码示例。如果您正苦于以下问题:Java ParametersAreNonnullByDefault类的具体用法?Java ParametersAreNonnullByDefault怎么用?Java ParametersAreNonnullByDefault使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ParametersAreNonnullByDefault类属于javax.annotation包,在下文中一共展示了ParametersAreNonnullByDefault类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: notNullByDefault_package_qualifiedName
import javax.annotation.ParametersAreNonnullByDefault; //导入依赖的package包/类
@Test
public void notNullByDefault_package_qualifiedName() {
String packageInfoSource = String.format(
"@%s\n" +
"package %s;\n",
ParametersAreNonnullByDefault.class.getName(), PACKAGE);
String testSource = String.format(
"package %s;\n" +
"" +
"public class %s {\n" +
"\n" +
" public %s(Integer intParam) {\n" +
" }\n" +
"\n" +
" public static void main(String[] args) {\n" +
" new %s(null);\n" +
" }\n" +
"}", PACKAGE, CLASS_NAME, CLASS_NAME, CLASS_NAME);
expectNpeFromParameterCheck(testSource, "intParam", expectRunResult);
doTest(new TestSourceImpl(testSource, PACKAGE + "." + CLASS_NAME),
new TestSourceImpl(packageInfoSource, PACKAGE + "." + PACKAGE_INFO));
}
示例2: notNullByDefault_class
import javax.annotation.ParametersAreNonnullByDefault; //导入依赖的package包/类
@Test
public void notNullByDefault_class() {
String testSource = String.format(
"@%s\n" +
"public class %s {\n" +
"\n" +
" public %s(Integer intParam) {\n" +
" }\n" +
"\n" +
" public static void main(String[] args) {\n" +
" new %s(null);\n" +
" }\n" +
"}", ParametersAreNonnullByDefault.class.getName(), CLASS_NAME, CLASS_NAME, CLASS_NAME);
expectNpeFromParameterCheck(testSource, "intParam", expectRunResult);
doTest(CLASS_NAME, testSource);
}
示例3: notNullByDefault_method
import javax.annotation.ParametersAreNonnullByDefault; //导入依赖的package包/类
@Test
public void notNullByDefault_method() {
String testSource = String.format(
"public class %s {\n" +
"\n" +
" @%s\n" +
" public %s(Integer intParam) {\n" +
" }\n" +
"\n" +
" public static void main(String[] args) {\n" +
" new %s(null);\n" +
" }\n" +
"}", CLASS_NAME, ParametersAreNonnullByDefault.class.getName(), CLASS_NAME, CLASS_NAME);
expectNpeFromParameterCheck(testSource, "intParam", expectRunResult);
doTest(CLASS_NAME, testSource);
}
示例4: notNullByDefault_nullableArgument
import javax.annotation.ParametersAreNonnullByDefault; //导入依赖的package包/类
@Test
public void notNullByDefault_nullableArgument() {
String testSource = String.format(
"@%s\n" +
"public class %s {\n" +
"\n" +
" public %s(@%s Integer intParam) {\n" +
" }\n" +
"\n" +
" public static void main(String[] args) {\n" +
" new %s(null);\n" +
" }\n" +
"}", ParametersAreNonnullByDefault.class.getName(), CLASS_NAME, CLASS_NAME, Nullable.class.getName(),
CLASS_NAME);
doTest(CLASS_NAME, testSource);
}
示例5: notNullByDefault_customNullableAnnotation
import javax.annotation.ParametersAreNonnullByDefault; //导入依赖的package包/类
@Test
public void notNullByDefault_customNullableAnnotation() {
String testSource = String.format(
"@%s\n" +
"public class %s {\n" +
"\n" +
" public %s(@%s Integer intParam) {\n" +
" }\n" +
"\n" +
" public static void main(String[] args) {\n" +
" new %s(null);\n" +
" }\n" +
"}", ParametersAreNonnullByDefault.class.getName(), CLASS_NAME, CLASS_NAME, NN.class.getName(),
CLASS_NAME);
settingsBuilder.withNullableAnnotations(NN.class.getName());
doTest(CLASS_NAME, testSource);
}
示例6: booleanParameter
import javax.annotation.ParametersAreNonnullByDefault; //导入依赖的package包/类
@Test
public void booleanParameter() {
String testSource = String.format(
"package %s;\n" +
"\n" +
"@%s\n" +
"public class %s {\n" +
"\n" +
" public %s(boolean expression) {\n" +
" }\n" +
"\n" +
" public static void main(String[] args) {\n" +
" new %s(true);\n" +
" }\n" +
"}", PACKAGE, ParametersAreNonnullByDefault.class.getName(), CLASS_NAME, CLASS_NAME, CLASS_NAME);
doTest(testSource);
}
示例7: intercept
import javax.annotation.ParametersAreNonnullByDefault; //导入依赖的package包/类
@Override
@ParametersAreNonnullByDefault
public Response intercept(Chain chain) throws IOException {
Request original = chain.request();
if (original.url().encodedPath().equals("/oauth/token")) {
return chain.proceed(original.newBuilder()
.header("Content-Type", "application/x-www-form-urlencoded")
.header("Authorization", loginAuthorizationHeader)
.build());
} else if (tokenManager.getAccessToken() != null) {
return chain.proceed(original.newBuilder()
.header("Authorization", "Bearer " + tokenManager.getAccessToken())
.build());
} else {
return chain.proceed(original);
}
}
示例8: doAuthenticate
import javax.annotation.ParametersAreNonnullByDefault; //导入依赖的package包/类
@Override
@ParametersAreNonnullByDefault
public boolean doAuthenticate(Context context) {
boolean isUserAuthenticated = false;
final String userName = context.getUsername();
final String password = context.getPassword();
// Cleanup basic auth windows principal from HttpSession
windowsAuthenticationHelper.removeWindowsPrincipalForBasicAuth(context.getRequest());
if (StringUtils.isNotBlank(userName) && StringUtils.isNotBlank(password)) {
// Cleanup Windows Principal for sso only in case we are doing basic auth
windowsAuthenticationHelper.removeWindowsPrincipalForSso(context.getRequest());
WindowsPrincipal windowsPrincipal = windowsAuthenticationHelper.logonUser(userName, password);
if (windowsPrincipal != null) {
isUserAuthenticated = true;
windowsAuthenticationHelper.setWindowsPrincipalForBasicAuth(context.getRequest(), windowsPrincipal);
}
} else {
isUserAuthenticated = windowsAuthenticationHelper.isUserSsoAuthenticated(context.getRequest());
}
return isUserAuthenticated;
}
示例9: doRender
import javax.annotation.ParametersAreNonnullByDefault; //导入依赖的package包/类
@Override
@ParametersAreNonnullByDefault
public void doRender(EntitySmokeBomb entity, double x, double y, double z, float entityYaw, float partialTicks) {
GlStateManager.pushMatrix();
GlStateManager.translate((float)x, (float)y, (float)z);
GlStateManager.enableRescaleNormal();
GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate((float)(this.renderManager.options.thirdPersonView == 2 ? -1 : 1) * this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
if (this.renderOutlines) {
GlStateManager.enableColorMaterial();
GlStateManager.enableOutlineMode(this.getTeamColor(entity));
}
this.renderItem.renderItem(this.item, ItemCameraTransforms.TransformType.GROUND);
if (this.renderOutlines) {
GlStateManager.disableOutlineMode();
GlStateManager.disableColorMaterial();
}
GlStateManager.disableRescaleNormal();
GlStateManager.popMatrix();
super.doRender(entity, x, y, z, entityYaw, partialTicks);
}
示例10: doRender
import javax.annotation.ParametersAreNonnullByDefault; //导入依赖的package包/类
@Override
@ParametersAreNonnullByDefault
public void doRender(EntityRopeCoil entity, double x, double y, double z, float entityYaw, float partialTicks) {
GlStateManager.pushMatrix();
GlStateManager.translate((float)x, (float)y, (float)z);
GlStateManager.enableRescaleNormal();
GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate((float)(this.renderManager.options.thirdPersonView == 2 ? -1 : 1) * this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
if (this.renderOutlines) {
GlStateManager.enableColorMaterial();
GlStateManager.enableOutlineMode(this.getTeamColor(entity));
}
this.renderItem.renderItem(this.item, ItemCameraTransforms.TransformType.GROUND);
if (this.renderOutlines) {
GlStateManager.disableOutlineMode();
GlStateManager.disableColorMaterial();
}
GlStateManager.disableRescaleNormal();
GlStateManager.popMatrix();
super.doRender(entity, x, y, z, entityYaw, partialTicks);
}
示例11: getAttributeModifiers
import javax.annotation.ParametersAreNonnullByDefault; //导入依赖的package包/类
@Override
@ParametersAreNonnullByDefault
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack) {
Multimap<String, AttributeModifier> multimap = super.getAttributeModifiers(slot, stack);
if(slot == EntityEquipmentSlot.OFFHAND || slot == EntityEquipmentSlot.MAINHAND) {
if (this.hasSwordBlade(stack)) {
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(),
new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", 3.0 + (ConfigurationHandler.getInstance().damage), 0));
} else {
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(),
new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", 0, 0));
}
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", 1.8, 0));
}
return multimap;
}
示例12: Cache
import javax.annotation.ParametersAreNonnullByDefault; //导入依赖的package包/类
public Cache(final Loader<T> loader) {
cache = CacheBuilder.newBuilder()
.maximumSize(10000)
.expireAfterWrite(10, TimeUnit.MINUTES)
.build(new CacheLoader<String, CompletableFuture<Data<T>>>() {
@ParametersAreNonnullByDefault
@Override
public CompletableFuture<Data<T>> load(final String key) {
CompletableFuture<Data<T>> result = loader.get(key);
result.exceptionally(ex -> {
invalidateCache(key);
return null;
});
return result;
}
});
}
示例13: create
import javax.annotation.ParametersAreNonnullByDefault; //导入依赖的package包/类
@Nonnull
@ParametersAreNonnullByDefault
public static Skin create(BufferedImage image) {
Preconditions.checkNotNull(image, "image");
Preconditions.checkArgument(image.getHeight() == 32 && image.getWidth() == 64, "Image is not 32x64");
byte[] mcpeTexture = new byte[32 * 64 * 4];
int at = 0;
for (int i = 0; i < image.getHeight(); i++) {
for (int i1 = 0; i1 < image.getWidth(); i1++) {
int rgb = image.getRGB(i, i1);
mcpeTexture[at++] = (byte) ((rgb & 0x00ff0000) >> 16);
mcpeTexture[at++] = (byte) ((rgb & 0x0000ff00) >> 8);
mcpeTexture[at++] = (byte) (rgb & 0x000000ff);
mcpeTexture[at++] = (byte) ((rgb >> 24) & 0xff);
}
}
return new Skin("Standard_Custom", mcpeTexture);
}
示例14: create
import javax.annotation.ParametersAreNonnullByDefault; //导入依赖的package包/类
/**
* Create new composite listener for a collection of delegates.
*/
@SafeVarargs
public static <T extends ParseTreeListener> T create(Class<T> type, T... delegates) {
ImmutableList<T> listeners = ImmutableList.copyOf(delegates);
return Reflection.newProxy(type, new AbstractInvocationHandler() {
@Override
@ParametersAreNonnullByDefault
protected Object handleInvocation(Object proxy, Method method, Object[] args) throws Throwable {
for (T listener : listeners) {
method.invoke(listener, args);
}
return null;
}
@Override
public String toString() {
return MoreObjects.toStringHelper("CompositeParseTreeListener")
.add("listeners", listeners)
.toString();
}
});
}
示例15: RolesCache
import javax.annotation.ParametersAreNonnullByDefault; //导入依赖的package包/类
public RolesCache(int expiryMS) {
rolesCache = CacheBuilder.newBuilder()
.concurrencyLevel(concurrencyLevel)
.maximumSize(maximumSize)
.expireAfterWrite(expiryMS, TimeUnit.MILLISECONDS)
.removalListener(
new RemovalListener<String, Set<String>>() {
{
LOGGER.debug("Removal Listener created");
}
@Override
public void onRemoval(@ParametersAreNonnullByDefault RemovalNotification<String, Set<String>> notification) {
LOGGER.debug("This data from " + notification.getKey() + " evacuated due:" + notification.getCause());
}
}
).build();
fallbackRolesCache = CacheBuilder.newBuilder()
.concurrencyLevel(concurrencyLevel) // handle 10 concurrent request without a problem
.maximumSize(maximumSize) // Hold 500 sessions before remove them
.build();
LOGGER.info("RolesCache initialized with expiry={}", expiryMS);
}