Skip to content

Commit

Permalink
Move reflection and serialization configuration from Feature to json
Browse files Browse the repository at this point in the history
  • Loading branch information
zakkak committed Jan 30, 2023
1 parent f060bb8 commit dfd1429
Show file tree
Hide file tree
Showing 5 changed files with 265 additions and 371 deletions.
26 changes: 13 additions & 13 deletions core/builder/src/main/java/io/quarkus/builder/Json.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/**
* A simple JSON string generator.
*/
final class Json {
public final class Json {

private static final String OBJECT_START = "{";
private static final String OBJECT_END = "}";
Expand Down Expand Up @@ -47,7 +47,7 @@ private Json() {
/**
* @return the new JSON array builder, empty builders are not ignored
*/
static JsonArrayBuilder array() {
public static JsonArrayBuilder array() {
return new JsonArrayBuilder(false);
}

Expand All @@ -65,7 +65,7 @@ static JsonArrayBuilder array(boolean ignoreEmptyBuilders) {
*
* @return the new JSON object builder, empty builders are not ignored
*/
static JsonObjectBuilder object() {
public static JsonObjectBuilder object() {
return new JsonObjectBuilder(false);
}

Expand Down Expand Up @@ -142,7 +142,7 @@ protected boolean isValuesEmpty(Collection<Object> values) {
/**
* JSON array builder.
*/
static class JsonArrayBuilder extends JsonBuilder<JsonArrayBuilder> {
public static class JsonArrayBuilder extends JsonBuilder<JsonArrayBuilder> {

private final List<Object> values;

Expand All @@ -156,12 +156,12 @@ JsonArrayBuilder add(JsonArrayBuilder value) {
return this;
}

JsonArrayBuilder add(JsonObjectBuilder value) {
public JsonArrayBuilder add(JsonObjectBuilder value) {
addInternal(value);
return this;
}

JsonArrayBuilder add(String value) {
public JsonArrayBuilder add(String value) {
addInternal(value);
return this;
}
Expand Down Expand Up @@ -205,7 +205,7 @@ String build() throws IOException {
}

@Override
void appendTo(Appendable appendable) throws IOException {
public void appendTo(Appendable appendable) throws IOException {
appendable.append(ARRAY_START);
int idx = 0;
for (ListIterator<Object> iterator = values.listIterator(); iterator.hasNext();) {
Expand All @@ -231,7 +231,7 @@ protected JsonArrayBuilder self() {
/**
* JSON object builder.
*/
static class JsonObjectBuilder extends JsonBuilder<JsonObjectBuilder> {
public static class JsonObjectBuilder extends JsonBuilder<JsonObjectBuilder> {

private final Map<String, Object> properties;

Expand All @@ -240,22 +240,22 @@ private JsonObjectBuilder(boolean ignoreEmptyBuilders) {
this.properties = new HashMap<String, Object>();
}

JsonObjectBuilder put(String name, String value) {
public JsonObjectBuilder put(String name, String value) {
putInternal(name, value);
return this;
}

JsonObjectBuilder put(String name, JsonObjectBuilder value) {
public JsonObjectBuilder put(String name, JsonObjectBuilder value) {
putInternal(name, value);
return this;
}

JsonObjectBuilder put(String name, JsonArrayBuilder value) {
public JsonObjectBuilder put(String name, JsonArrayBuilder value) {
putInternal(name, value);
return this;
}

JsonObjectBuilder put(String name, boolean value) {
public JsonObjectBuilder put(String name, boolean value) {
putInternal(name, value);
return this;
}
Expand Down Expand Up @@ -295,7 +295,7 @@ String build() throws IOException {
}

@Override
void appendTo(Appendable appendable) throws IOException {
public void appendTo(Appendable appendable) throws IOException {
appendable.append(OBJECT_START);
int idx = 0;
for (Iterator<Entry<String, Object>> iterator = properties.entrySet().iterator(); iterator.hasNext();) {
Expand Down
Loading

0 comments on commit dfd1429

Please sign in to comment.