Skip to content

Commit 4f2ddb2

Browse files
committed
Fixed bug with missing .object(boolean) override
1 parent 148240f commit 4f2ddb2

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<properties>
88
<maven.compiler.source>8</maven.compiler.source>
99
<maven.compiler.target>8</maven.compiler.target>
10-
<buildVersion>1.0.2-SNAPSHOT</buildVersion>
10+
<buildVersion>1.0.3-SNAPSHOT</buildVersion>
1111
</properties>
1212

1313
<groupId>org.javawebstack</groupId>

src/main/java/org/javawebstack/abstractdata/AbstractObject.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,22 @@ public boolean isObject() {
6565
return true;
6666
}
6767

68-
public AbstractObject object() {
68+
public AbstractObject object(boolean strict) throws AbstractCoercingException {
6969
return this;
7070
}
7171

72+
public AbstractArray array(boolean strict) throws AbstractCoercingException {
73+
if(strict)
74+
throw new AbstractCoercingException(Type.ARRAY, Type.OBJECT);
75+
AbstractArray array = new AbstractArray();
76+
for (int i = 0; i < size(); i++) {
77+
if (!has(String.valueOf(i)))
78+
throw new AbstractCoercingException(Type.ARRAY, this);
79+
array.add(get(String.valueOf(i)));
80+
}
81+
return array;
82+
}
83+
7284
public AbstractElement get(String key) {
7385
return entries.get(key);
7486
}
@@ -127,18 +139,6 @@ public int size() {
127139
return entries.size();
128140
}
129141

130-
public AbstractArray array(boolean strict) throws AbstractCoercingException {
131-
if(strict)
132-
throw new AbstractCoercingException(Type.ARRAY, Type.OBJECT);
133-
AbstractArray array = new AbstractArray();
134-
for (int i = 0; i < size(); i++) {
135-
if (!has(String.valueOf(i)))
136-
throw new AbstractCoercingException(Type.ARRAY, this);
137-
array.add(get(String.valueOf(i)));
138-
}
139-
return array;
140-
}
141-
142142
public AbstractObject object(String key) throws AbstractCoercingException {
143143
return query(key, AbstractNull.VALUE).object();
144144
}

0 commit comments

Comments
 (0)