diff options
author | Mike Buland <eichlan@xagasoft.com> | 2012-02-13 16:53:22 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2012-02-13 16:53:22 +0000 |
commit | 3d872dc4a5f91ca9c1041526358ceb4aaa31d39c (patch) | |
tree | ceaeb797f86d3a2f7a4e0b4aaa28fe109f02488c /java/FileExample.java | |
parent | 06f34a151f59343809154268da272022994fef45 (diff) | |
download | libgats-3d872dc4a5f91ca9c1041526358ceb4aaa31d39c.tar.gz libgats-3d872dc4a5f91ca9c1041526358ceb4aaa31d39c.tar.bz2 libgats-3d872dc4a5f91ca9c1041526358ceb4aaa31d39c.tar.xz libgats-3d872dc4a5f91ca9c1041526358ceb4aaa31d39c.zip |
Trying a more sensible handling for get helpers in GatsDictionary, they throw
an exception now if the key isn't found. getInt and getFloat will both probably
be complimented by getBigInt and getBigFloat or something like it later on,
but we'll always return types from those helpers that can't contain a null,
so exceptions it is.
Diffstat (limited to 'java/FileExample.java')
-rw-r--r-- | java/FileExample.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/java/FileExample.java b/java/FileExample.java index f85f88d..6f180d9 100644 --- a/java/FileExample.java +++ b/java/FileExample.java | |||
@@ -73,6 +73,14 @@ class FileExample | |||
73 | // the string object yourself. | 73 | // the string object yourself. |
74 | System.out.println("Sub string: " + new String( | 74 | System.out.println("Sub string: " + new String( |
75 | root.getDict("Dictionary").getString("name") ) ); | 75 | root.getDict("Dictionary").getString("name") ) ); |
76 | |||
77 | root.get("aoeu"); | ||
78 | root.getDict("aoeu"); | ||
79 | root.getList("aoeu"); | ||
80 | root.getInt("aoeu"); | ||
81 | root.getFloat("aoeu"); | ||
82 | root.getBool("aoeu"); | ||
83 | root.getString("aoeu"); | ||
76 | } | 84 | } |
77 | catch( FileNotFoundException e ) | 85 | catch( FileNotFoundException e ) |
78 | { | 86 | { |
@@ -82,6 +90,10 @@ class FileExample | |||
82 | { | 90 | { |
83 | System.out.println("Error reading data."); | 91 | System.out.println("Error reading data."); |
84 | } | 92 | } |
93 | catch( KeyNotFoundException e ) | ||
94 | { | ||
95 | System.out.println("Key not found."); | ||
96 | } | ||
85 | } | 97 | } |
86 | 98 | ||
87 | public static void main( String args[] ) | 99 | public static void main( String args[] ) |