• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Nullable类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.kyori.blizzard.Nullable的典型用法代码示例。如果您正苦于以下问题:Java Nullable类的具体用法?Java Nullable怎么用?Java Nullable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Nullable类属于net.kyori.blizzard包,在下文中一共展示了Nullable类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: process

import net.kyori.blizzard.Nullable; //导入依赖的package包/类
@Override
public void process(@NonNull final CommandContext context, @NonNull final String arguments) throws CommandException {
  final int index = arguments.indexOf(' ');
  final String name = index != NO_MATCH ? arguments.substring(0, index) : arguments;
  @Nullable final CommandMapping mapping = this.get(name);
  if(mapping == null) {
    throw new UnknownCommandException(name);
  }

  final String args = index != NO_MATCH ? arguments.substring(index + 1) : "";
  final CommandCallable callable = mapping.callable();
  if(!callable.testPermission(context)) {
    throw new AuthorizationException();
  }
  callable.process(context, args);
}
 
开发者ID:KyoriPowered,项目名称:ghost,代码行数:17,代码来源:DispatcherImpl.java


示例2: createArgument

import net.kyori.blizzard.Nullable; //导入依赖的package包/类
@NonNull
private static <T> Argument createArgument(@NonNull final Binder binder, @NonNull final Type type, @NonNull final List<? extends Annotation> annotations) {
  @Nullable Annotation classifier = null;
  final List<Annotation> modifiers = new ArrayList<>();

  for(final Annotation annotation : annotations) {
    // Capture a classifier if an annotation is annotated
    if(annotation.annotationType().getAnnotation(Classifier.class) != null) {
      classifier = annotation;
    } else {
      modifiers.add(annotation);
    }
  }

  @Nullable final Binding<T> binding = binder.binding(BindingKey.of(type, classifier != null ? classifier.annotationType() : null));
  if(binding == null) {
    throw new IllegalArgumentException("Could not find a binding for argument type '" + type + "' with modifiers " + annotations);
  }

  return new Argument(binding.provider(), modifiers);
}
 
开发者ID:KyoriPowered,项目名称:ghost,代码行数:22,代码来源:ArgumentParser.java


示例3: resolveGroup

import net.kyori.blizzard.Nullable; //导入依赖的package包/类
@NonNull
private Dispatcher resolveGroup(@NonNull final Group group, @NonNull final Dispatcher dispatcher) {
  Dispatcher node = dispatcher;
  for(final String entry : group.value()) {
    @Nullable final CommandMapping mapping = node.get(entry);
    if(mapping == null) {
      final Dispatcher child = new DispatcherImpl();
      node.register(child, entry);
      node = child;
    } else if(mapping.callable() instanceof Dispatcher) {
      node = (Dispatcher) mapping.callable();
    } else {
      throw new IllegalStateException("Can't put command at " + entry + " because there is an existing command there");
    }
  }
  return node;
}
 
开发者ID:KyoriPowered,项目名称:ghost,代码行数:18,代码来源:MethodCommandCallableRegistrar.java


示例4: serialize

import net.kyori.blizzard.Nullable; //导入依赖的package包/类
@Override
public JsonElement serialize(final Profile profile, final Type typeOfSrc, final JsonSerializationContext context) {
  final JsonObject object = new JsonObject();

  @Nullable final UUID id = profile.id();
  if(id != null) {
    object.add("id", context.serialize(id));
  }

  @Nullable final String name = profile.name();
  if(name != null) {
    object.addProperty("name", name);
  }

  return object;
}
 
开发者ID:KyoriPowered,项目名称:yggdrasil,代码行数:17,代码来源:ProfileSerializer.java


示例5: serialize

import net.kyori.blizzard.Nullable; //导入依赖的package包/类
@Override
public JsonElement serialize(final ProfilePropertyMap src, final Type typeOfSrc, final JsonSerializationContext context) {
  final JsonArray result = new JsonArray();

  for(final ProfileProperty property : src.values()) {
    final JsonObject object = new JsonObject();

    object.addProperty("name", property.name());
    object.addProperty("value", property.value());

    @Nullable final String signature = property.signature();
    if(signature != null) {
      object.addProperty("signature", signature);
    }

    result.add(object);
  }

  return result;
}
 
开发者ID:KyoriPowered,项目名称:yggdrasil,代码行数:21,代码来源:ProfilePropertyMapSerializer.java


示例6: hasJoined

import net.kyori.blizzard.Nullable; //导入依赖的package包/类
@Nullable
@Override
public Profile hasJoined(@NonNull final Profile profile, @NonNull final String serverId, @Nullable final InetAddress address) throws AuthenticationException {
  final HttpUrl.Builder url = BASE_URL.newBuilder()
    .addPathSegment("hasJoined")
    .addQueryParameter("username", profile.name())
    .addQueryParameter("serverId", serverId);
  if(address != null) {
    url.addQueryParameter("ip", address.getHostAddress());
  }

  @Nullable final HasJoinedResponse response = this.get(url.build(), HasJoinedResponse.class);
  if(response == null || response.id() == null) {
    return null;
  }

  final Profile result = Profile.of(response.id(), profile.name());
  if(response.properties() != null) {
    result.properties().putAll(response.properties());
  }
  return result;
}
 
开发者ID:KyoriPowered,项目名称:yggdrasil,代码行数:23,代码来源:YggdrasilSessionService.java


示例7: equals

import net.kyori.blizzard.Nullable; //导入依赖的package包/类
default boolean equals(@Nullable final Matrix4d matrix) {
  return matrix != null
    && this.m00() == matrix.m00()
    && this.m01() == matrix.m01()
    && this.m02() == matrix.m02()
    && this.m03() == matrix.m03()
    && this.m10() == matrix.m10()
    && this.m11() == matrix.m11()
    && this.m12() == matrix.m12()
    && this.m13() == matrix.m13()
    && this.m20() == matrix.m20()
    && this.m21() == matrix.m21()
    && this.m22() == matrix.m22()
    && this.m23() == matrix.m23()
    && this.m30() == matrix.m30()
    && this.m31() == matrix.m31()
    && this.m32() == matrix.m32()
    && this.m33() == matrix.m33();
}
 
开发者ID:KyoriPowered,项目名称:math,代码行数:20,代码来源:Matrix4d.java


示例8: equals

import net.kyori.blizzard.Nullable; //导入依赖的package包/类
default boolean equals(@Nullable final Matrix4f matrix) {
  return matrix != null
    && this.m00() == matrix.m00()
    && this.m01() == matrix.m01()
    && this.m02() == matrix.m02()
    && this.m03() == matrix.m03()
    && this.m10() == matrix.m10()
    && this.m11() == matrix.m11()
    && this.m12() == matrix.m12()
    && this.m13() == matrix.m13()
    && this.m20() == matrix.m20()
    && this.m21() == matrix.m21()
    && this.m22() == matrix.m22()
    && this.m23() == matrix.m23()
    && this.m30() == matrix.m30()
    && this.m31() == matrix.m31()
    && this.m32() == matrix.m32()
    && this.m33() == matrix.m33();
}
 
开发者ID:KyoriPowered,项目名称:math,代码行数:20,代码来源:Matrix4f.java


示例9: registerCompletion

import net.kyori.blizzard.Nullable; //导入依赖的package包/类
private void registerCompletion(final Method method, final Dispatcher dispatcher, final Completion completion) {
  for(final String alias : completion.value()) {
    @Nullable final CommandMapping mapping = dispatcher.get(alias);
    if(mapping == null) continue;
    if(mapping.callable() instanceof MethodCommandCallable) {
      if(!((MethodCommandCallable) mapping.callable()).acceptingSuggestions()) {
        throw new IllegalStateException("Can't set suggestion provider of " + mapping.callable() + ", provider already set");
      }
      final ArgumentParser parser = ArgumentParser.of(MethodCommandCallableRegistrar.this.binder, method);
      ((MethodCommandCallable) mapping.callable()).suggestionsFrom(this.object, method, parser);
    }
  }
}
 
开发者ID:KyoriPowered,项目名称:ghost,代码行数:14,代码来源:MethodCommandCallableRegistrar.java


示例10: unregisterCompletion

import net.kyori.blizzard.Nullable; //导入依赖的package包/类
private void unregisterCompletion(final Dispatcher dispatcher, final Completion completion) {
  for(final String alias : completion.value()) {
    @Nullable final CommandMapping mapping = dispatcher.get(alias);
    if(mapping == null) continue;
    if(mapping.callable() instanceof MethodCommandCallable) {
      ((MethodCommandCallable) mapping.callable()).suggestionsFrom(null, null, null);
    }
  }
}
 
开发者ID:KyoriPowered,项目名称:ghost,代码行数:10,代码来源:MethodCommandCallableRegistrar.java


示例11: build

import net.kyori.blizzard.Nullable; //导入依赖的package包/类
@NonNull
@Override
public Binder build() {
  return new Binder() {
    @Nullable
    @Override
    public <T> Binding<T> binding(@NonNull final BindingKey<T> key) {
      return (Binding<T>) BinderBuilder.this.bindings.get(key);
    }
  };
}
 
开发者ID:KyoriPowered,项目名称:ghost,代码行数:12,代码来源:BinderBuilder.java


示例12: annotatedWith

import net.kyori.blizzard.Nullable; //导入依赖的package包/类
@NonNull
@Override
public Binding.Builder<T> annotatedWith(@Nullable final Class<? extends Annotation> annotation) {
  if(annotation != null) {
    checkArgument(annotation.getAnnotation(Classifier.class) != null, "The '@%s' annotation must be decorated with '@%s' to be used as a classifier", annotation.getName(), Classifier.class.getName());
  }
  return new BindingBuilder<>(this.binder, this.key.classifier(annotation));
}
 
开发者ID:KyoriPowered,项目名称:ghost,代码行数:9,代码来源:BinderBuilder.java


示例13: MethodCommandCallable

import net.kyori.blizzard.Nullable; //导入依赖的package包/类
MethodCommandCallable(@NonNull final Object object, @NonNull final Method method, @NonNull final ArgumentParser parser, @NonNull final Authorizer authorizer) {
  this.object = object;
  this.method = method;
  this.parser = parser;
  this.authorizer = authorizer;

  @Nullable final Permission permission = method.getAnnotation(Permission.class);
  this.permissions = permission != null ? permission.value() : null;
}
 
开发者ID:KyoriPowered,项目名称:ghost,代码行数:10,代码来源:MethodCommandCallable.java


示例14: install

import net.kyori.blizzard.Nullable; //导入依赖的package包/类
@Override
public void install(final Module module) {
  @Nullable final DuplexBinderImpl activeBinder = ACTIVE_BINDER.get();
  ACTIVE_BINDER.set(this);
  try {
    this.privateBinder.install(module);
  } finally {
    ACTIVE_BINDER.set(activeBinder);
  }
}
 
开发者ID:KyoriPowered,项目名称:violet,代码行数:11,代码来源:DuplexBinder.java


示例15: Impl

import net.kyori.blizzard.Nullable; //导入依赖的package包/类
/**
 * Constructs a profile.
 *
 * @param id the id
 * @param name the name
 * @throws IllegalArgumentException if both {@code id} and {@code name} are null
 */
protected Impl(@Nullable final UUID id, @Nullable final String name) {
  if(id == null && name == null) {
    throw new IllegalArgumentException("id and name are both null");
  }
  this.id = id;
  this.name = name;
}
 
开发者ID:KyoriPowered,项目名称:yggdrasil,代码行数:15,代码来源:Profile.java


示例16: deserialize

import net.kyori.blizzard.Nullable; //导入依赖的package包/类
@Override
public Profile deserialize(final JsonElement json, final Type typeOfT, final JsonDeserializationContext context) throws JsonParseException {
  final JsonObject object = (JsonObject) json;
  @Nullable final UUID id = object.has("id") ? context.deserialize(object.get("id"), UUID.class) : null;
  @Nullable final String name = object.has("name") ? object.getAsJsonPrimitive("name").getAsString() : null;
  return Profile.of(id, name);
}
 
开发者ID:KyoriPowered,项目名称:yggdrasil,代码行数:8,代码来源:ProfileSerializer.java


示例17: fill

import net.kyori.blizzard.Nullable; //导入依赖的package包/类
private Profile fill(final Profile profile, final boolean secure) throws AuthenticationException {
  final HttpUrl.Builder url = BASE_URL.newBuilder()
    .addPathSegment("profile")
    .addPathSegment(UUIDTypeAdapter.string(profile.id()))
    .addQueryParameter("unsigned", String.valueOf(!secure));
  @Nullable final ProfileResponse response = this.get(url.build(), ProfileResponse.class);
  if(response == null) {
    return profile;
  }

  final Profile result = Profile.of(response.id(), response.name());
  result.properties().putAll(response.properties());
  profile.properties().putAll(response.properties());
  return result;
}
 
开发者ID:KyoriPowered,项目名称:yggdrasil,代码行数:16,代码来源:YggdrasilSessionService.java


示例18: get

import net.kyori.blizzard.Nullable; //导入依赖的package包/类
@Nullable
private <T extends Response> T get(final HttpUrl url, final Class<T> responseClass) throws AuthenticationException {
  final Request request = new Request.Builder()
    .url(url)
    .build();
  return this.request(request, responseClass);
}
 
开发者ID:KyoriPowered,项目名称:yggdrasil,代码行数:8,代码来源:YggdrasilSessionService.java


示例19: equals

import net.kyori.blizzard.Nullable; //导入依赖的package包/类
default boolean equals(@Nullable final Matrix3d matrix) {
  return matrix != null
    && this.m00() == matrix.m00()
    && this.m01() == matrix.m01()
    && this.m02() == matrix.m02()
    && this.m10() == matrix.m10()
    && this.m11() == matrix.m11()
    && this.m12() == matrix.m12()
    && this.m20() == matrix.m20()
    && this.m21() == matrix.m21()
    && this.m22() == matrix.m22();
}
 
开发者ID:KyoriPowered,项目名称:math,代码行数:13,代码来源:Matrix3d.java


示例20: equals

import net.kyori.blizzard.Nullable; //导入依赖的package包/类
default boolean equals(@Nullable final Matrix2d matrix) {
  return matrix != null
    && this.m00() == matrix.m00()
    && this.m01() == matrix.m01()
    && this.m10() == matrix.m10()
    && this.m11() == matrix.m11();
}
 
开发者ID:KyoriPowered,项目名称:math,代码行数:8,代码来源:Matrix2d.java



注:本文中的net.kyori.blizzard.Nullable类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LightList类代码示例发布时间:2022-05-23
下一篇:
Java AuditQueryCallback类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap