Skip to content

Commit

Permalink
Apply auto-formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
safris committed Sep 26, 2023
1 parent 82f1046 commit d3e4ca2
Show file tree
Hide file tree
Showing 73 changed files with 587 additions and 472 deletions.
2 changes: 1 addition & 1 deletion binding/src/main/java/org/jsonx/AnyArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/**
* An {@link ArrayType} that represents any JSON array.
*/
@AnyElement(id=0, minOccurs=0)
@AnyElement(id = 0, minOccurs = 0)
@ArrayType(elementIds = 0)
public @interface AnyArray {
}
15 changes: 10 additions & 5 deletions binding/src/main/java/org/jsonx/AnyCodec.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ else if (annotationType == AnyProperty.class)
final int len = types.length;
if (firstChar == '[') {
t type = len > 0 ? types[0] : AnyType.arrays;
int i = 0; do {
int i = 0;
do {
final Class<? extends Annotation> arrays = type.arrays();
if (AnyType.isEnabled(arrays)) {
final int index = reader.getIndex();
Expand All @@ -68,7 +69,8 @@ else if (annotationType == AnyProperty.class)
}
else if (firstChar == '{') {
t type = len > 0 ? types[0] : AnyType.objects;
int i = 0; do {
int i = 0;
do {
final Class<? extends JxObject> objects = type.objects();
if (AnyType.isEnabled(objects)) {
final Object value = ObjectCodec.decodeArray(objects, token, reader, validate, onPropertyDecode);
Expand All @@ -88,7 +90,8 @@ else if (firstChar == '{') {
}
else {
t type = len > 0 ? types[0] : AnyType.fromToken(token);
int i = 0; do {
int i = 0;
do {
final BooleanType booleans;
final NumberType numbers;
final StringType strings;
Expand Down Expand Up @@ -124,7 +127,8 @@ static Error encodeArray(final AnyElement annotation, final Object object, final
Error error = Error.NULL;
final int len = types.length;
t type = len > 0 ? types[0] : AnyType.fromObject(object);
int i = 0; do {
int i = 0;
do {
final StringType strings;
final NumberType numbers;
final BooleanType booleans;
Expand Down Expand Up @@ -177,7 +181,8 @@ static Object encodeObject(final Annotation annotation, final Method getMethod,
StringBuilder builder = null;
final int len = types.length;
t type = len > 0 ? types[0] : AnyType.fromObject(object);
int i = 0; do {
int i = 0;
do {
final StringType strings;
final NumberType numbers;
final BooleanType booleans;
Expand Down
3 changes: 3 additions & 0 deletions binding/src/main/java/org/jsonx/AnyElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@
@Repeatable(AnyElements.class)
public @interface AnyElement {
int id();

boolean nullable() default true;

int minOccurs() default 1;

int maxOccurs() default Integer.MAX_VALUE;

t[] types() default {};
Expand Down
2 changes: 1 addition & 1 deletion binding/src/main/java/org/jsonx/AnyObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
public class AnyObject implements JxObject {
private LinkedHashMap<String,Object> properties;

@AnyProperty(name=".*")
@AnyProperty(name = ".*")
public LinkedHashMap<String,Object> getProperties() {
return properties;
}
Expand Down
2 changes: 2 additions & 0 deletions binding/src/main/java/org/jsonx/AnyProperty.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
@Retention(RetentionPolicy.RUNTIME)
public @interface AnyProperty {
String name();

boolean nullable() default true;

Use use() default Use.REQUIRED;

t[] types() default {};
Expand Down
5 changes: 5 additions & 0 deletions binding/src/main/java/org/jsonx/ArrayElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,17 @@
@Repeatable(ArrayElements.class)
public @interface ArrayElement {
int id();

boolean nullable() default true;

int minOccurs() default 1;

int maxOccurs() default Integer.MAX_VALUE;

int minIterate() default 1;

int maxIterate() default 1;

int[] elementIds() default {};

Class<? extends Annotation> type() default ArrayType.class;
Expand Down
4 changes: 4 additions & 0 deletions binding/src/main/java/org/jsonx/ArrayProperty.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,15 @@
@Retention(RetentionPolicy.RUNTIME)
public @interface ArrayProperty {
String name();

boolean nullable() default true;

Use use() default Use.REQUIRED;

int minIterate() default 1;

int maxIterate() default 1;

int[] elementIds() default {};

Class<? extends Annotation> type() default ArrayType.class;
Expand Down
2 changes: 2 additions & 0 deletions binding/src/main/java/org/jsonx/ArrayType.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
@Retention(RetentionPolicy.RUNTIME)
public @interface ArrayType {
int minIterate() default 1;

int maxIterate() default 1;

int[] elementIds();
}
3 changes: 2 additions & 1 deletion binding/src/main/java/org/jsonx/ArrayValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ else if (annotation instanceof AnyElement) {
error = iterator.validate(annotation, index, relations, idToElement, codecType, validate, onPropertyDecode);
}

// System.err.println("m[" + index + "], a[" + a + "], o(" + minOccurs + ", " + maxOccurs + ")[" + occurrence + "], i(" + minIterate + ", " + maxIterate + ")[" + iteration + "]");
// System.err.println("m[" + index + "], a[" + a + "], o(" + minOccurs + ", " + maxOccurs + ")[" + occurrence + "], i(" + minIterate
// + ", " + maxIterate + ")[" + iteration + "]");

try {
// int before;
Expand Down
5 changes: 5 additions & 0 deletions binding/src/main/java/org/jsonx/BooleanElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,16 @@
@Retention(RetentionPolicy.RUNTIME)
public @interface BooleanElement {
int id();

boolean nullable() default true;

int minOccurs() default 1;

int maxOccurs() default Integer.MAX_VALUE;

Class<?> type() default Boolean.class;

String decode() default "";

String encode() default "";
}
3 changes: 3 additions & 0 deletions binding/src/main/java/org/jsonx/BooleanProperty.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@
@Retention(RetentionPolicy.RUNTIME)
public @interface BooleanProperty {
String name();

boolean nullable() default true;

Use use() default Use.REQUIRED;

String decode() default "";

String encode() default "";
}
2 changes: 2 additions & 0 deletions binding/src/main/java/org/jsonx/BooleanType.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
@Retention(RetentionPolicy.RUNTIME)
public @interface BooleanType {
Class<?> type() default Boolean.class;

String decode() default "";

String encode() default "";
}
Loading

0 comments on commit d3e4ca2

Please sign in to comment.