-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from relinc/#16JSON-File-Format
#16 json file format
- Loading branch information
Showing
23 changed files
with
648 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
Libraries/src/net/relinc/libraries/application/JsonReader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package net.relinc.libraries.application; | ||
|
||
import org.json.simple.JSONObject; | ||
|
||
import java.util.Optional; | ||
|
||
// Quick wrapper for using Optionals instead of null. | ||
public class JsonReader { | ||
private JSONObject ob; | ||
|
||
public JsonReader(JSONObject ob) { | ||
if(ob == null) { | ||
this.ob = new JSONObject(); | ||
} else { | ||
this.ob = ob; | ||
} | ||
} | ||
|
||
public Optional<Object> get(Object key) { | ||
Object res = this.ob.get(key); | ||
if(res == null) { | ||
return Optional.empty(); | ||
} else { | ||
return Optional.of(res); | ||
} | ||
} | ||
} |
Oops, something went wrong.