net.vz.mongodb.jackson.internal.object
Class BsonObjectTraversingParser

java.lang.Object
  extended by org.codehaus.jackson.JsonParser
      extended by net.vz.mongodb.jackson.internal.object.BsonObjectTraversingParser
All Implemented Interfaces:
Closeable, JacksonDBCollectionProvider, org.codehaus.jackson.Versioned

public class BsonObjectTraversingParser
extends org.codehaus.jackson.JsonParser
implements JacksonDBCollectionProvider

Parses a BSONObject by traversing it. This class was copied from org.codehaus.jackson.node.TreeTraversingParser and then adapted to be for BSONObject's, rather than JsonNode's. While decoding by the cursor uses DBDecoderBsonParser, there are still things that need to be decoded from the DBObjects, including the result of findAndModify, and saved objects after saving.

Since:
1.0
Author:
James Roper

Nested Class Summary
 
Nested classes/interfaces inherited from class org.codehaus.jackson.JsonParser
org.codehaus.jackson.JsonParser.Feature, org.codehaus.jackson.JsonParser.NumberType
 
Field Summary
protected  boolean closed
          Flag that indicates whether parser is closed or not.
protected  org.codehaus.jackson.JsonToken nextToken
          Sometimes parser needs to buffer a single look-ahead token; if so, it'll be stored here.
protected  net.vz.mongodb.jackson.internal.object.BsonObjectCursor nodeCursor
          Traversal context within tree
protected  org.codehaus.jackson.ObjectCodec objectCodec
           
protected  boolean startContainer
          Flag needed to handle recursion into contents of child Array/Object nodes.
 
Fields inherited from class org.codehaus.jackson.JsonParser
_currToken, _features, _lastClearedToken
 
Constructor Summary
BsonObjectTraversingParser(JacksonDBCollection dbCollection, org.bson.BSONObject o)
           
BsonObjectTraversingParser(JacksonDBCollection dbCollection, org.bson.BSONObject o, org.codehaus.jackson.ObjectCodec codec)
           
 
Method Summary
 void close()
           
protected  Object currentNode()
           
 BigInteger getBigIntegerValue()
           
 byte[] getBinaryValue(org.codehaus.jackson.Base64Variant b64variant)
           
 org.codehaus.jackson.ObjectCodec getCodec()
           
 org.codehaus.jackson.JsonLocation getCurrentLocation()
           
 String getCurrentName()
           
 JacksonDBCollection getDBCollection()
          Get the JacksonDBCollection that this object knows about
 BigDecimal getDecimalValue()
           
 double getDoubleValue()
           
 Object getEmbeddedObject()
           
 float getFloatValue()
           
 int getIntValue()
           
 long getLongValue()
           
 org.codehaus.jackson.JsonParser.NumberType getNumberType()
           
 Number getNumberValue()
           
 org.codehaus.jackson.JsonStreamContext getParsingContext()
           
 String getText()
           
 char[] getTextCharacters()
           
 int getTextLength()
           
 int getTextOffset()
           
 org.codehaus.jackson.JsonLocation getTokenLocation()
           
 boolean hasTextCharacters()
           
 boolean isClosed()
           
 org.codehaus.jackson.JsonToken nextToken()
           
 void setCodec(org.codehaus.jackson.ObjectCodec c)
           
 org.codehaus.jackson.JsonParser skipChildren()
           
 
Methods inherited from class org.codehaus.jackson.JsonParser
_constructError, canUseSchema, clearCurrentToken, configure, disable, disableFeature, enable, enableFeature, getBinaryValue, getBooleanValue, getByteValue, getCurrentToken, getInputSource, getLastClearedToken, getShortValue, getValueAsBoolean, getValueAsBoolean, getValueAsDouble, getValueAsDouble, getValueAsInt, getValueAsInt, getValueAsLong, getValueAsLong, hasCurrentToken, isEnabled, isExpectedStartArrayToken, isFeatureEnabled, nextBooleanValue, nextFieldName, nextIntValue, nextLongValue, nextTextValue, nextValue, readValueAs, readValueAs, readValueAsTree, readValuesAs, readValuesAs, releaseBuffered, releaseBuffered, setFeature, setSchema, version
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

objectCodec

protected org.codehaus.jackson.ObjectCodec objectCodec

nodeCursor

protected net.vz.mongodb.jackson.internal.object.BsonObjectCursor nodeCursor
Traversal context within tree


nextToken

protected org.codehaus.jackson.JsonToken nextToken
Sometimes parser needs to buffer a single look-ahead token; if so, it'll be stored here. This is currently used for handling


startContainer

protected boolean startContainer
Flag needed to handle recursion into contents of child Array/Object nodes.


closed

protected boolean closed
Flag that indicates whether parser is closed or not. Gets set when parser is either closed by explicit call (close()) or when end-of-input is reached.

Constructor Detail

BsonObjectTraversingParser

public BsonObjectTraversingParser(JacksonDBCollection dbCollection,
                                  org.bson.BSONObject o)

BsonObjectTraversingParser

public BsonObjectTraversingParser(JacksonDBCollection dbCollection,
                                  org.bson.BSONObject o,
                                  org.codehaus.jackson.ObjectCodec codec)
Method Detail

setCodec

public void setCodec(org.codehaus.jackson.ObjectCodec c)
Specified by:
setCodec in class org.codehaus.jackson.JsonParser

getCodec

public org.codehaus.jackson.ObjectCodec getCodec()
Specified by:
getCodec in class org.codehaus.jackson.JsonParser

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Specified by:
close in class org.codehaus.jackson.JsonParser
Throws:
IOException

nextToken

public org.codehaus.jackson.JsonToken nextToken()
                                         throws IOException
Specified by:
nextToken in class org.codehaus.jackson.JsonParser
Throws:
IOException

skipChildren

public org.codehaus.jackson.JsonParser skipChildren()
                                             throws IOException
Specified by:
skipChildren in class org.codehaus.jackson.JsonParser
Throws:
IOException

isClosed

public boolean isClosed()
Specified by:
isClosed in class org.codehaus.jackson.JsonParser

getCurrentName

public String getCurrentName()
Specified by:
getCurrentName in class org.codehaus.jackson.JsonParser

getParsingContext

public org.codehaus.jackson.JsonStreamContext getParsingContext()
Specified by:
getParsingContext in class org.codehaus.jackson.JsonParser

getTokenLocation

public org.codehaus.jackson.JsonLocation getTokenLocation()
Specified by:
getTokenLocation in class org.codehaus.jackson.JsonParser

getCurrentLocation

public org.codehaus.jackson.JsonLocation getCurrentLocation()
Specified by:
getCurrentLocation in class org.codehaus.jackson.JsonParser

getText

public String getText()
Specified by:
getText in class org.codehaus.jackson.JsonParser

getTextCharacters

public char[] getTextCharacters()
                         throws IOException
Specified by:
getTextCharacters in class org.codehaus.jackson.JsonParser
Throws:
IOException

getTextLength

public int getTextLength()
                  throws IOException
Specified by:
getTextLength in class org.codehaus.jackson.JsonParser
Throws:
IOException

getTextOffset

public int getTextOffset()
                  throws IOException
Specified by:
getTextOffset in class org.codehaus.jackson.JsonParser
Throws:
IOException

hasTextCharacters

public boolean hasTextCharacters()
Overrides:
hasTextCharacters in class org.codehaus.jackson.JsonParser

getNumberType

public org.codehaus.jackson.JsonParser.NumberType getNumberType()
                                                         throws IOException
Specified by:
getNumberType in class org.codehaus.jackson.JsonParser
Throws:
IOException

getBigIntegerValue

public BigInteger getBigIntegerValue()
                              throws IOException
Specified by:
getBigIntegerValue in class org.codehaus.jackson.JsonParser
Throws:
IOException

getDecimalValue

public BigDecimal getDecimalValue()
                           throws IOException
Specified by:
getDecimalValue in class org.codehaus.jackson.JsonParser
Throws:
IOException

getDoubleValue

public double getDoubleValue()
                      throws IOException
Specified by:
getDoubleValue in class org.codehaus.jackson.JsonParser
Throws:
IOException

getFloatValue

public float getFloatValue()
                    throws IOException
Specified by:
getFloatValue in class org.codehaus.jackson.JsonParser
Throws:
IOException

getLongValue

public long getLongValue()
                  throws IOException
Specified by:
getLongValue in class org.codehaus.jackson.JsonParser
Throws:
IOException

getIntValue

public int getIntValue()
                throws IOException
Specified by:
getIntValue in class org.codehaus.jackson.JsonParser
Throws:
IOException

getNumberValue

public Number getNumberValue()
                      throws IOException
Specified by:
getNumberValue in class org.codehaus.jackson.JsonParser
Throws:
IOException

getBinaryValue

public byte[] getBinaryValue(org.codehaus.jackson.Base64Variant b64variant)
                      throws IOException
Specified by:
getBinaryValue in class org.codehaus.jackson.JsonParser
Throws:
IOException

getEmbeddedObject

public Object getEmbeddedObject()
                         throws IOException,
                                org.codehaus.jackson.JsonParseException
Overrides:
getEmbeddedObject in class org.codehaus.jackson.JsonParser
Throws:
IOException
org.codehaus.jackson.JsonParseException

currentNode

protected Object currentNode()

getDBCollection

public JacksonDBCollection getDBCollection()
Description copied from interface: JacksonDBCollectionProvider
Get the JacksonDBCollection that this object knows about

Specified by:
getDBCollection in interface JacksonDBCollectionProvider
Returns:
The JackosnDBCollection


Copyright © 2011-2012 VZ Netzwerke. All Rights Reserved.