public final class ToHashMap<E> extends Object implements BSONParseListener
HashMap
.Constructor and Description |
---|
ToHashMap(BSONDecoder<E> decoder) |
Modifier and Type | Method and Description |
---|---|
boolean |
abort()
returns false
|
static ToHashMap<Object> |
apply()
Creates a ToHashMap using a
ToJavaCollectionBSONDecoder decoder |
static <E> ToHashMap<E> |
apply(BSONDecoder<E> decoder) |
void |
ended()
Stops parsing, and prevents any further parsing events from happening until
started() is called again. |
HashMap<String,E> |
getResult()
returns the generated HashMap
|
void |
newKeyValue(byte a,
String key,
DataInput c)
Parses a value of type typeOfValue from reader, treats that as a value, and then
does whatever with the key-value pair.
|
void |
started()
restarts the item count
|
public ToHashMap(BSONDecoder<E> decoder)
public static ToHashMap<Object> apply()
ToJavaCollectionBSONDecoder
decoderpublic static <E> ToHashMap<E> apply(BSONDecoder<E> decoder)
public void started() throws IllegalStateException
started
in interface BSONParseListener
IllegalStateException
- if #started is called twice between invocation of #endedpublic void ended()
started()
is called again.ended
in interface BSONParseListener
IllegalStateException
- if this cannot accept parse eventsParseException
public void newKeyValue(byte a, String key, DataInput c) throws NullPointerException, IOException, ParseException, UnsupportedOperationException
BSONParseListener
newKeyValue
in interface BSONParseListener
key
- the pair's keyc
- the input values, to obtain a value fromNullPointerException
IOException
ParseException
UnsupportedOperationException
public HashMap<String,E> getResult()
public boolean abort() throws IllegalStateException
abort
in interface BSONParseListener
IllegalStateException
- never