public class BSONDecorator extends Object
DBObject
used by MongoDB in an easy way by
directly specifying the fully qualified names of fields.Constructor and Description |
---|
BSONDecorator(com.mongodb.DBObject obj) |
Modifier and Type | Method and Description |
---|---|
com.mongodb.DBObject |
asDBObject()
Access the decorated
BSONObject . |
boolean |
containsField(String fieldName)
Check if the field passed in parameter exists or not.
|
Object |
get(String fieldName)
Access field as an object, no casting.
|
Boolean |
getBoolean(String fieldName)
Access field as a boolean.
|
ByteBuffer |
getBytes(String fieldName)
Access field as bytes.
|
Date |
getDate(String fieldName)
Access field as a date.
|
com.mongodb.BasicDBList |
getDBList(String fieldName)
Access field as a
BasicDBList . |
com.mongodb.BasicDBObject |
getDBObject(String fieldName)
Access field as a
BasicDBObject . |
Double |
getDouble(String fieldName)
Access field as a double.
|
Integer |
getInt(String fieldName)
Access field as a int.
|
Long |
getLong(String fieldName)
Access field as a long.
|
org.apache.avro.util.Utf8 |
getUtf8String(String fieldName)
Access field as a Utf8 string.
|
void |
put(String fieldName,
Object value)
Set field.
|
public com.mongodb.DBObject asDBObject()
BSONObject
.DBObject
in its actual statepublic boolean containsField(String fieldName)
fieldName
- fully qualified name of the fieldDBObject
, false otherwisepublic com.mongodb.BasicDBObject getDBObject(String fieldName)
BasicDBObject
.fieldName
- fully qualified name of the field to be accessedBasicDBObject
public com.mongodb.BasicDBList getDBList(String fieldName)
BasicDBList
.fieldName
- fully qualified name of the field to be accessedBasicDBList
public Boolean getBoolean(String fieldName)
fieldName
- fully qualified name of the field to be accessedpublic Double getDouble(String fieldName)
fieldName
- fully qualified name of the field to be accessedpublic Integer getInt(String fieldName)
fieldName
- fully qualified name of the field to be accessedpublic Long getLong(String fieldName)
fieldName
- fully qualified name of the field to be accessedpublic Date getDate(String fieldName)
fieldName
- fully qualified name of the field to be accessedpublic org.apache.avro.util.Utf8 getUtf8String(String fieldName)
fieldName
- fully qualified name of the field to be accessedUtf8
stringpublic ByteBuffer getBytes(String fieldName)
fieldName
- fully qualified name of the field to be accessedpublic Object get(String fieldName)
fieldName
- fully qualified name of the field to be accessedCopyright © 2010-2015 The Apache Software Foundation. All Rights Reserved.