Skip to content

Commit 32e57af

Browse files
committed
added comment and convenience method for getBoolean
1 parent 0c6eb27 commit 32e57af

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/main/org/bson/BasicBSONObject.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,19 @@ public String getString( String key ){
158158
return foo.toString();
159159
}
160160

161+
/** Returns the value of a field as a boolean.
162+
* @param key the field to look up
163+
* @return the value of the field, or false if field does not exist
164+
*/
165+
public boolean getBoolean( String key ){
166+
return getBoolean(key, false);
167+
}
168+
169+
/** Returns the value of a field as a boolean
170+
* @param key the field to look up
171+
* @param def the default value in case the field is not found
172+
* @return the value of the field, converted to a string
173+
*/
161174
public boolean getBoolean( String key , boolean def ){
162175
Object foo = get( key );
163176
if ( foo == null )

0 commit comments

Comments
 (0)