Skip to content
This repository was archived by the owner on Aug 3, 2021. It is now read-only.

Commit c21f704

Browse files
committed
Documentation
1 parent 971148b commit c21f704

File tree

6 files changed

+356
-128
lines changed

6 files changed

+356
-128
lines changed

JSONJavaWrapper/src/com/xdestx/json/JArray.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
package com.xdestx.json;
22

3+
/**
4+
* A wrapper class for an Array of {@link com.xdest.json.JOk JOk} objects.
5+
* @author xDestx
6+
*
7+
*/
38
class JArray implements JOk {
49

510
private final JOk[] jarr;
6-
11+
/**
12+
* Construct an Object with the specified array
13+
* @param jarr
14+
*/
715
public JArray(JOk[] jarr) {
816
this.jarr = jarr;
917
}
1018

19+
1120
public String toJSONString() {
1221
String jsonString = "";
1322
jsonString+='[';
@@ -19,6 +28,10 @@ public String toJSONString() {
1928
return jsonString;
2029
}
2130

31+
/**
32+
* Retrieve the array stored by this obejct
33+
* @return
34+
*/
2235
public JOk[] getArray() {
2336
return this.jarr;
2437
}

JSONJavaWrapper/src/com/xdestx/json/JBoolean.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
package com.xdestx.json;
22

3+
/**
4+
* A boolean wrapper class.
5+
* @author xDestx
6+
*
7+
*/
38
public class JBoolean implements JOk {
49

510
private final boolean b;
11+
/**
12+
* Construct a boolean object
13+
* @param b
14+
*/
615
public JBoolean(boolean b) {
716
this.b = b;
817
}
@@ -11,6 +20,10 @@ public String toJSONString() {
1120
return ""+this.b;
1221
}
1322

23+
/**
24+
* Get the boolean value of this object
25+
* @return
26+
*/
1427
public boolean getValue() {
1528
return this.b;
1629
}

JSONJavaWrapper/src/com/xdestx/json/JNumber.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,71 @@
11
package com.xdestx.json;
22

3+
/**
4+
* A Number wrapper. All numbers are converted to a double.
5+
* @author xDestx
6+
*
7+
*/
38
public class JNumber implements JOk {
49

510
private final double d;
611

12+
/**
13+
* Construct a number using a double
14+
* @param d the number
15+
*/
716
public JNumber(double d) {
817
this.d = d;
918
}
1019

20+
/**
21+
* Construct a number using {@link java.lang.Number}
22+
* @param n
23+
*/
1124
public JNumber(Number n) {
1225
this.d = n.doubleValue();
1326
}
1427

28+
/**
29+
* Construct a number using an int
30+
* @param n
31+
*/
1532
public JNumber(int n) {
1633
this.d = (double)n;
1734
}
1835

36+
/**
37+
* Construct a number using a float
38+
* @param n
39+
*/
1940
public JNumber(float n) {
2041
this.d = (double)n;
2142
}
2243

44+
/**
45+
* Constructa number using a short
46+
* @param n
47+
*/
2348
public JNumber(short n) {
2449
this.d = (double)n;
2550
}
2651

52+
/**
53+
* Construct a number using a long (Converted to a double, use caution)
54+
* @param n
55+
*/
2756
public JNumber(long n) {
2857
this.d = (double)n;
2958
}
3059

60+
3161
public String toJSONString() {
3262
return ""+d;
3363
}
3464

65+
/**
66+
* Retrieve the value of this number
67+
* @return the double value
68+
*/
3569
public double getValue() {
3670
return this.d;
3771
}
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
package com.xdestx.json;
2-
2+
/**
3+
* An interface representing an object which is compatible with JSONObjects
4+
* @author xDest
5+
*
6+
*/
37
public interface JOk {
8+
/**
9+
* The String representation of this component or object.
10+
* @return A JSON formatted string represeting this object
11+
*/
412
public String toJSONString();
513
}

0 commit comments

Comments
 (0)