Skip to content

Commit

Permalink
Use @JsonGen annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
vietj committed Nov 30, 2023
1 parent c7c5cbc commit 2b4ec87
Show file tree
Hide file tree
Showing 18 changed files with 54 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class AggregateOptionsConverter {
private static final Base64.Decoder BASE64_DECODER = JsonUtil.BASE64_DECODER;
private static final Base64.Encoder BASE64_ENCODER = JsonUtil.BASE64_ENCODER;

public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, AggregateOptions obj) {
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, AggregateOptions obj) {
for (java.util.Map.Entry<String, Object> member : json) {
switch (member.getKey()) {
case "collation":
Expand All @@ -44,11 +44,11 @@ public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json,
}
}

public static void toJson(AggregateOptions obj, JsonObject json) {
static void toJson(AggregateOptions obj, JsonObject json) {
toJson(obj, json.getMap());
}

public static void toJson(AggregateOptions obj, java.util.Map<String, Object> json) {
static void toJson(AggregateOptions obj, java.util.Map<String, Object> json) {
if (obj.getCollation() != null) {
json.put("collation", obj.getCollation().toJson());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class CollationOptionsConverter {
private static final Base64.Decoder BASE64_DECODER = JsonUtil.BASE64_DECODER;
private static final Base64.Encoder BASE64_ENCODER = JsonUtil.BASE64_ENCODER;

public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, CollationOptions obj) {
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, CollationOptions obj) {
for (java.util.Map.Entry<String, Object> member : json) {
switch (member.getKey()) {
case "normalization":
Expand Down Expand Up @@ -54,11 +54,11 @@ public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json,
}
}

public static void toJson(CollationOptions obj, JsonObject json) {
static void toJson(CollationOptions obj, JsonObject json) {
toJson(obj, json.getMap());
}

public static void toJson(CollationOptions obj, java.util.Map<String, Object> json) {
static void toJson(CollationOptions obj, java.util.Map<String, Object> json) {
if (obj.isNormalization() != null) {
json.put("normalization", obj.isNormalization());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class CountOptionsConverter {
private static final Base64.Decoder BASE64_DECODER = JsonUtil.BASE64_DECODER;
private static final Base64.Encoder BASE64_ENCODER = JsonUtil.BASE64_ENCODER;

public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, CountOptions obj) {
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, CountOptions obj) {
for (java.util.Map.Entry<String, Object> member : json) {
switch (member.getKey()) {
case "hint":
Expand Down Expand Up @@ -54,11 +54,11 @@ public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json,
}
}

public static void toJson(CountOptions obj, JsonObject json) {
static void toJson(CountOptions obj, JsonObject json) {
toJson(obj, json.getMap());
}

public static void toJson(CountOptions obj, java.util.Map<String, Object> json) {
static void toJson(CountOptions obj, java.util.Map<String, Object> json) {
if (obj.getHint() != null) {
json.put("hint", obj.getHint());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class CreateCollectionOptionsConverter {
private static final Base64.Decoder BASE64_DECODER = JsonUtil.BASE64_DECODER;
private static final Base64.Encoder BASE64_ENCODER = JsonUtil.BASE64_ENCODER;

public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, CreateCollectionOptions obj) {
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, CreateCollectionOptions obj) {
for (java.util.Map.Entry<String, Object> member : json) {
switch (member.getKey()) {
case "maxDocuments":
Expand Down Expand Up @@ -69,11 +69,11 @@ public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json,
}
}

public static void toJson(CreateCollectionOptions obj, JsonObject json) {
static void toJson(CreateCollectionOptions obj, JsonObject json) {
toJson(obj, json.getMap());
}

public static void toJson(CreateCollectionOptions obj, java.util.Map<String, Object> json) {
static void toJson(CreateCollectionOptions obj, java.util.Map<String, Object> json) {
if (obj.getMaxDocuments() != null) {
json.put("maxDocuments", obj.getMaxDocuments());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class DistinctOptionsConverter {
private static final Base64.Decoder BASE64_DECODER = JsonUtil.BASE64_DECODER;
private static final Base64.Encoder BASE64_ENCODER = JsonUtil.BASE64_ENCODER;

public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, DistinctOptions obj) {
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, DistinctOptions obj) {
for (java.util.Map.Entry<String, Object> member : json) {
switch (member.getKey()) {
case "collation":
Expand All @@ -29,11 +29,11 @@ public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json,
}
}

public static void toJson(DistinctOptions obj, JsonObject json) {
static void toJson(DistinctOptions obj, JsonObject json) {
toJson(obj, json.getMap());
}

public static void toJson(DistinctOptions obj, java.util.Map<String, Object> json) {
static void toJson(DistinctOptions obj, java.util.Map<String, Object> json) {
if (obj.getCollation() != null) {
json.put("collation", obj.getCollation().toJson());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class FindOptionsConverter {
private static final Base64.Decoder BASE64_DECODER = JsonUtil.BASE64_DECODER;
private static final Base64.Encoder BASE64_ENCODER = JsonUtil.BASE64_ENCODER;

public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, FindOptions obj) {
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, FindOptions obj) {
for (java.util.Map.Entry<String, Object> member : json) {
switch (member.getKey()) {
case "collation":
Expand Down Expand Up @@ -64,11 +64,11 @@ public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json,
}
}

public static void toJson(FindOptions obj, JsonObject json) {
static void toJson(FindOptions obj, JsonObject json) {
toJson(obj, json.getMap());
}

public static void toJson(FindOptions obj, java.util.Map<String, Object> json) {
static void toJson(FindOptions obj, java.util.Map<String, Object> json) {
if (obj.getCollation() != null) {
json.put("collation", obj.getCollation().toJson());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class IndexModelConverter {
private static final Base64.Decoder BASE64_DECODER = JsonUtil.BASE64_DECODER;
private static final Base64.Encoder BASE64_ENCODER = JsonUtil.BASE64_ENCODER;

public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, IndexModel obj) {
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, IndexModel obj) {
for (java.util.Map.Entry<String, Object> member : json) {
switch (member.getKey()) {
case "key":
Expand All @@ -34,11 +34,11 @@ public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json,
}
}

public static void toJson(IndexModel obj, JsonObject json) {
static void toJson(IndexModel obj, JsonObject json) {
toJson(obj, json.getMap());
}

public static void toJson(IndexModel obj, java.util.Map<String, Object> json) {
static void toJson(IndexModel obj, java.util.Map<String, Object> json) {
if (obj.getKey() != null) {
json.put("key", obj.getKey());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class TimeSeriesOptionsConverter {
private static final Base64.Decoder BASE64_DECODER = JsonUtil.BASE64_DECODER;
private static final Base64.Encoder BASE64_ENCODER = JsonUtil.BASE64_ENCODER;

public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, TimeSeriesOptions obj) {
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, TimeSeriesOptions obj) {
for (java.util.Map.Entry<String, Object> member : json) {
switch (member.getKey()) {
case "timeField":
Expand All @@ -39,11 +39,11 @@ public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json,
}
}

public static void toJson(TimeSeriesOptions obj, JsonObject json) {
static void toJson(TimeSeriesOptions obj, JsonObject json) {
toJson(obj, json.getMap());
}

public static void toJson(TimeSeriesOptions obj, java.util.Map<String, Object> json) {
static void toJson(TimeSeriesOptions obj, java.util.Map<String, Object> json) {
if (obj.getTimeField() != null) {
json.put("timeField", obj.getTimeField());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class ValidationOptionsConverter {
private static final Base64.Decoder BASE64_DECODER = JsonUtil.BASE64_DECODER;
private static final Base64.Encoder BASE64_ENCODER = JsonUtil.BASE64_ENCODER;

public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, ValidationOptions obj) {
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, ValidationOptions obj) {
for (java.util.Map.Entry<String, Object> member : json) {
switch (member.getKey()) {
case "validator":
Expand All @@ -39,11 +39,11 @@ public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json,
}
}

public static void toJson(ValidationOptions obj, JsonObject json) {
static void toJson(ValidationOptions obj, JsonObject json) {
toJson(obj, json.getMap());
}

public static void toJson(ValidationOptions obj, java.util.Map<String, Object> json) {
static void toJson(ValidationOptions obj, java.util.Map<String, Object> json) {
if (obj.getValidator() != null) {
json.put("validator", obj.getValidator());
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/io/vertx/ext/mongo/AggregateOptions.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.vertx.ext.mongo;

import io.vertx.codegen.annotations.DataObject;
import io.vertx.codegen.json.annotations.JsonGen;
import io.vertx.core.json.JsonObject;

import java.util.Objects;
Expand All @@ -10,7 +11,8 @@
*
* @author <a href="mailto:[email protected]">Nick Scavelli</a>
*/
@DataObject(generateConverter = true)
@DataObject
@JsonGen(publicConverter = false)
public class AggregateOptions {
/**
* The default value of batchSize = 20.
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/io/vertx/ext/mongo/CollationOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.mongodb.client.model.*;
import io.vertx.codegen.annotations.DataObject;
import io.vertx.codegen.annotations.GenIgnore;
import io.vertx.codegen.json.annotations.JsonGen;
import io.vertx.core.json.JsonObject;

import java.util.Objects;
Expand All @@ -12,7 +13,8 @@
*
* @author <a href="mailto:[email protected]">Christoph Spörk</a>
*/
@DataObject(generateConverter = true)
@DataObject
@JsonGen(publicConverter = false)
public class CollationOptions {
/**
* Default locale : {@code simple}
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/io/vertx/ext/mongo/CountOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@


import io.vertx.codegen.annotations.DataObject;
import io.vertx.codegen.json.annotations.JsonGen;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.mongo.impl.JsonObjectBsonAdapter;

import java.util.Objects;
import java.util.concurrent.TimeUnit;

@DataObject(generateConverter = true)
@DataObject
@JsonGen(publicConverter = false)
public class CountOptions {
private JsonObject hint;
private String hintString;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.mongodb.client.model.IndexOptionDefaults;
import com.mongodb.lang.Nullable;
import io.vertx.codegen.annotations.DataObject;
import io.vertx.codegen.json.annotations.JsonGen;
import io.vertx.core.json.JsonObject;

import java.util.Objects;
Expand All @@ -12,7 +13,8 @@
/**
* Options for creating a collection
*/
@DataObject(generateConverter = true)
@DataObject
@JsonGen(publicConverter = false)
public class CreateCollectionOptions {
private Long maxDocuments;
private Boolean capped;
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/io/vertx/ext/mongo/DistinctOptions.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package io.vertx.ext.mongo;

import io.vertx.codegen.annotations.DataObject;
import io.vertx.codegen.json.annotations.JsonGen;
import io.vertx.core.json.JsonObject;

import java.util.Objects;

@DataObject(generateConverter = true)
@DataObject
@JsonGen(publicConverter = false)
public class DistinctOptions {
CollationOptions collation;

Expand Down
4 changes: 3 additions & 1 deletion src/main/java/io/vertx/ext/mongo/FindOptions.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.vertx.ext.mongo;

import io.vertx.codegen.annotations.DataObject;
import io.vertx.codegen.json.annotations.JsonGen;
import io.vertx.core.json.JsonObject;

import java.util.Objects;
Expand All @@ -10,7 +11,8 @@
*
* @author <a href="mailto:[email protected]">Nick Scavelli</a>
*/
@DataObject(generateConverter = true)
@DataObject
@JsonGen(publicConverter = false)
public class FindOptions {

/**
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/io/vertx/ext/mongo/IndexModel.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package io.vertx.ext.mongo;

import io.vertx.codegen.annotations.DataObject;
import io.vertx.codegen.json.annotations.JsonGen;
import io.vertx.core.json.JsonObject;

import java.util.Objects;

@DataObject(generateConverter = true)
@DataObject
@JsonGen(publicConverter = false)
public class IndexModel {
private JsonObject key;
private IndexOptions options;
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/io/vertx/ext/mongo/TimeSeriesOptions.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.vertx.ext.mongo;

import io.vertx.codegen.annotations.DataObject;
import io.vertx.codegen.json.annotations.JsonGen;
import io.vertx.core.json.JsonObject;

import java.util.Objects;
Expand All @@ -12,7 +13,8 @@
*
* @author <a href="mailto:[email protected]">Liu Chong</a>
*/
@DataObject(generateConverter = true)
@DataObject
@JsonGen(publicConverter = false)
public class TimeSeriesOptions {

/**
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/io/vertx/ext/mongo/ValidationOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
import com.mongodb.client.model.ValidationLevel;
import com.mongodb.lang.Nullable;
import io.vertx.codegen.annotations.DataObject;
import io.vertx.codegen.json.annotations.JsonGen;
import io.vertx.core.json.JsonObject;

import java.util.Objects;

@DataObject(generateConverter = true)
@DataObject
@JsonGen(publicConverter = false)
public final class ValidationOptions {
private JsonObject validator = new JsonObject();
private ValidationLevel validationLevel;
Expand Down

0 comments on commit 2b4ec87

Please sign in to comment.