本文整理汇总了Java中io.vertx.codegen.annotations.Nullable类的典型用法代码示例。如果您正苦于以下问题:Java Nullable类的具体用法?Java Nullable怎么用?Java Nullable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Nullable类属于io.vertx.codegen.annotations包,在下文中一共展示了Nullable类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: handle
import io.vertx.codegen.annotations.Nullable; //导入依赖的package包/类
private void handle(RoutingContext rc) {
@Nullable JsonObject json = rc.getBodyAsJson();
if (json == null || json.getDouble("amount") == null) {
System.out.println("No content or no amount");
rc.fail(400);
return;
}
double amount = json.getDouble("amount");
String target = json.getString("currency");
if (target == null) {
target = "EUR";
}
double rate = getRate(target);
if (rate == -1) {
System.out.println("Unknown currency: " + target);
rc.fail(400);
}
int i = random.nextInt(10);
if (i < 5) {
rc.response().end(new JsonObject()
.put("amount", convert(amount, rate))
.put("currency", target).encode()
);
} else if (i < 8) {
// Failure
rc.fail(500);
}
// Timeout, we don't write the response.
}
开发者ID:cescoffier,项目名称:vertx-kubernetes-workshop,代码行数:33,代码来源:CurrencyService.java
示例2: methodWithListNullableStringReturn
import io.vertx.codegen.annotations.Nullable; //导入依赖的package包/类
@Override
public List<@Nullable String> methodWithListNullableStringReturn() {
ArrayList<String> ret = new ArrayList<>();
ret.add("first");
ret.add(null);
ret.add("third");
return ret;
}
开发者ID:vert-x3,项目名称:vertx-codegen,代码行数:9,代码来源:NullableTCKImpl.java
示例3: removeDocumentsWithOptions
import io.vertx.codegen.annotations.Nullable; //导入依赖的package包/类
@Override
public MongoClient removeDocumentsWithOptions(String collection, JsonObject query, @Nullable WriteOption writeOption, Handler<AsyncResult<MongoClientDeleteResult>> resultHandler) {
requireNonNull(collection, "collection cannot be null");
requireNonNull(query, "query cannot be null");
requireNonNull(resultHandler, "resultHandler cannot be null");
MongoCollection<JsonObject> coll = getCollection(collection, writeOption);
Bson bquery = wrap(encodeKeyWhenUseObjectId(query));
coll.deleteMany(bquery, toMongoClientDeleteResult(resultHandler));
return this;
}
开发者ID:vert-x3,项目名称:vertx-mongo-client,代码行数:12,代码来源:MongoClientImpl.java
示例4: getCollection
import io.vertx.codegen.annotations.Nullable; //导入依赖的package包/类
private MongoCollection<JsonObject> getCollection(String name, @Nullable WriteOption writeOption) {
MongoCollection<JsonObject> coll = holder.db.getCollection(name, JsonObject.class);
if (coll != null && writeOption != null) {
coll = coll.withWriteConcern(WriteConcern.valueOf(writeOption.name()));
}
return coll;
}
开发者ID:vert-x3,项目名称:vertx-mongo-client,代码行数:8,代码来源:MongoClientImpl.java
示例5: methodWithNullableJsonObjectReturn
import io.vertx.codegen.annotations.Nullable; //导入依赖的package包/类
@Override
public @Nullable JsonObject methodWithNullableJsonObjectReturn(boolean notNull) {
if (notNull) {
return new JsonObject().put("foo", "wibble").put("bar", 3);
} else {
return null;
}
}
开发者ID:vert-x3,项目名称:vertx-codegen,代码行数:9,代码来源:NullableTCKImpl.java
示例6: bodyAsJsonObject
import io.vertx.codegen.annotations.Nullable; //导入依赖的package包/类
/**
* @return the response body decoded as a json object
*/
@CacheReturn
@Nullable
default JsonObject bodyAsJsonObject() {
Buffer b = bodyAsBuffer();
return b != null ? BodyCodecImpl.JSON_OBJECT_DECODER.apply(b) : null;
}
开发者ID:vert-x3,项目名称:vertx-web,代码行数:10,代码来源:HttpResponse.java
示例7: subtag
import io.vertx.codegen.annotations.Nullable; //导入依赖的package包/类
@Override
public @Nullable String subtag(int level) {
ensureHeaderProcessed();
if(level < parsedValues.size()){
return parsedValues.get(level);
}
return null;
}
开发者ID:vert-x3,项目名称:vertx-web,代码行数:9,代码来源:ParsableLanguageValue.java
示例8: methodWithNullableListJsonObjectReturn
import io.vertx.codegen.annotations.Nullable; //导入依赖的package包/类
@Override
public @Nullable List<JsonObject> methodWithNullableListJsonObjectReturn(boolean notNull) {
if (notNull) {
return Arrays.asList(new JsonObject().put("foo", "bar"), new JsonObject().put("juu", 3));
} else {
return null;
}
}
开发者ID:vert-x3,项目名称:vertx-codegen,代码行数:9,代码来源:NullableTCKImpl.java
示例9: methodWithNullableListCharReturn
import io.vertx.codegen.annotations.Nullable; //导入依赖的package包/类
@Override
public @Nullable List<Character> methodWithNullableListCharReturn(boolean notNull) {
if (notNull) {
return Arrays.asList('x', 'y', 'z');
} else {
return null;
}
}
开发者ID:vert-x3,项目名称:vertx-codegen,代码行数:9,代码来源:NullableTCKImpl.java
示例10: getAlias
import io.vertx.codegen.annotations.Nullable; //导入依赖的package包/类
private @Nullable String getAlias() {
return context.request().getParam("alias");
}
开发者ID:pflima92,项目名称:jspare-vertx-ms-blueprint,代码行数:4,代码来源:AuditFuture.java
示例11: endHandler
import io.vertx.codegen.annotations.Nullable; //导入依赖的package包/类
@Override
public HttpServerResponse endHandler(@Nullable Handler<Void> handler) {
serverResponse.endHandler(handler);
return null;
}
开发者ID:groupon,项目名称:vertx-utils,代码行数:6,代码来源:HttpServerResponseWrapper.java
示例12: methodWithNullableListGenEnumHandlerAsyncResult
import io.vertx.codegen.annotations.Nullable; //导入依赖的package包/类
@Override
public void methodWithNullableListGenEnumHandlerAsyncResult(boolean notNull, Handler<AsyncResult<@Nullable List<TestGenEnum>>> handler) {
handler.handle(Future.succeededFuture(methodWithNullableListGenEnumReturn(notNull)));
}
开发者ID:vert-x3,项目名称:vertx-codegen,代码行数:5,代码来源:NullableTCKImpl.java
示例13: methodWithSetNullableLongHandlerAsyncResult
import io.vertx.codegen.annotations.Nullable; //导入依赖的package包/类
@Override
public void methodWithSetNullableLongHandlerAsyncResult(Handler<AsyncResult<Set<@Nullable Long>>> handler) {
handler.handle(Future.succeededFuture(methodWithSetNullableLongReturn()));
}
开发者ID:vert-x3,项目名称:vertx-codegen,代码行数:5,代码来源:NullableTCKImpl.java
示例14: toBson
import io.vertx.codegen.annotations.Nullable; //导入依赖的package包/类
@Nullable
private static Bson toBson(@Nullable JsonObject json) {
return json == null ? null : BsonDocument.parse(json.encode());
}
开发者ID:vert-x3,项目名称:vertx-mongo-client,代码行数:5,代码来源:MongoClientImpl.java
示例15: wrap
import io.vertx.codegen.annotations.Nullable; //导入依赖的package包/类
@Nullable
private JsonObjectBsonAdapter wrap(@Nullable JsonObject jsonObject) {
return jsonObject == null ? null : new JsonObjectBsonAdapter(jsonObject);
}
开发者ID:vert-x3,项目名称:vertx-mongo-client,代码行数:5,代码来源:MongoClientImpl.java
示例16: methodWithNullableMapIntegerHandlerAsyncResult
import io.vertx.codegen.annotations.Nullable; //导入依赖的package包/类
@Override
public void methodWithNullableMapIntegerHandlerAsyncResult(boolean notNull, Handler<AsyncResult<@Nullable Map<String, Integer>>> handler) {
handler.handle(Future.succeededFuture(methodWithNullableMapIntegerReturn(notNull)));
}
开发者ID:vert-x3,项目名称:vertx-codegen,代码行数:5,代码来源:NullableTCKImpl.java
示例17: methodWithNullableFloatHandler
import io.vertx.codegen.annotations.Nullable; //导入依赖的package包/类
@Override
public void methodWithNullableFloatHandler(boolean notNull, Handler<@Nullable Float> handler) {
handler.handle(methodWithNullableFloatReturn(notNull));
}
开发者ID:vert-x3,项目名称:vertx-codegen,代码行数:5,代码来源:NullableTCKImpl.java
示例18: methodWithMapNullableShortHandlerAsyncResult
import io.vertx.codegen.annotations.Nullable; //导入依赖的package包/类
@Override
public void methodWithMapNullableShortHandlerAsyncResult(Handler<AsyncResult<Map<String, @Nullable Short>>> handler) {
handler.handle(Future.succeededFuture(methodWithMapNullableShortReturn()));
}
开发者ID:vert-x3,项目名称:vertx-codegen,代码行数:5,代码来源:NullableTCKImpl.java
示例19: methodWithNullableMapShortHandler
import io.vertx.codegen.annotations.Nullable; //导入依赖的package包/类
@Override
public void methodWithNullableMapShortHandler(boolean notNull, Handler<@Nullable Map<String, Short>> handler) {
handler.handle(methodWithNullableMapShortReturn(notNull));
}
开发者ID:vert-x3,项目名称:vertx-codegen,代码行数:5,代码来源:NullableTCKImpl.java
示例20: methodWithNullableDoubleHandlerAsyncResult
import io.vertx.codegen.annotations.Nullable; //导入依赖的package包/类
@Override
public void methodWithNullableDoubleHandlerAsyncResult(boolean notNull, Handler<AsyncResult<@Nullable Double>> handler) {
handler.handle(Future.succeededFuture(methodWithNullableDoubleReturn(notNull)));
}
开发者ID:vert-x3,项目名称:vertx-codegen,代码行数:5,代码来源:NullableTCKImpl.java
注:本文中的io.vertx.codegen.annotations.Nullable类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论