diff options
author | Mike Buland <eichlan@xagasoft.com> | 2012-02-13 16:55:37 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2012-02-13 16:55:37 +0000 |
commit | 1dbbf711979031c338694407d25758574beaf833 (patch) | |
tree | a847dca6ffe986b62724e62fdef38085e2d539b6 /java/com/xagasoft/gats | |
parent | 3d872dc4a5f91ca9c1041526358ceb4aaa31d39c (diff) | |
download | libgats-1dbbf711979031c338694407d25758574beaf833.tar.gz libgats-1dbbf711979031c338694407d25758574beaf833.tar.bz2 libgats-1dbbf711979031c338694407d25758574beaf833.tar.xz libgats-1dbbf711979031c338694407d25758574beaf833.zip |
Consistancy is best, so all the get helpers throw an exception if they can't
find their object.
Diffstat (limited to 'java/com/xagasoft/gats')
-rw-r--r-- | java/com/xagasoft/gats/GatsDictionary.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/java/com/xagasoft/gats/GatsDictionary.java b/java/com/xagasoft/gats/GatsDictionary.java index 3517b68..b04f02c 100644 --- a/java/com/xagasoft/gats/GatsDictionary.java +++ b/java/com/xagasoft/gats/GatsDictionary.java | |||
@@ -203,9 +203,12 @@ public class GatsDictionary extends GatsObject implements Map<String,GatsObject> | |||
203 | * key specified does not appear in the GatsDictionary or is not the correct | 203 | * key specified does not appear in the GatsDictionary or is not the correct |
204 | * type you will get the expected exception. | 204 | * type you will get the expected exception. |
205 | */ | 205 | */ |
206 | public GatsDictionary getDict( String key ) | 206 | public GatsDictionary getDict( String key ) throws KeyNotFoundException |
207 | { | 207 | { |
208 | return (GatsDictionary)hValue.get( key ); | 208 | GatsDictionary ret = (GatsDictionary)hValue.get( key ); |
209 | if( ret == null ) | ||
210 | throw new KeyNotFoundException( this, key ); | ||
211 | return ret; | ||
209 | } | 212 | } |
210 | 213 | ||
211 | /** | 214 | /** |
@@ -214,9 +217,12 @@ public class GatsDictionary extends GatsObject implements Map<String,GatsObject> | |||
214 | * key specified does not appear in the GatsDictionary or is not the correct | 217 | * key specified does not appear in the GatsDictionary or is not the correct |
215 | * type you will get the expected exception. | 218 | * type you will get the expected exception. |
216 | */ | 219 | */ |
217 | public GatsList getList( String key ) | 220 | public GatsList getList( String key ) throws KeyNotFoundException |
218 | { | 221 | { |
219 | return (GatsList)hValue.get( key ); | 222 | GatsList ret = (GatsList)hValue.get( key ); |
223 | if( ret == null ) | ||
224 | throw new KeyNotFoundException( this, key ); | ||
225 | return ret; | ||
220 | } | 226 | } |
221 | 227 | ||
222 | public void putAll( Map<? extends String, ? extends GatsObject> src ) | 228 | public void putAll( Map<? extends String, ? extends GatsObject> src ) |