com.jrodeo.bson.marshallers.StringMarshaller Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bson-marshaller Show documentation
Show all versions of bson-marshaller Show documentation
A tool to create Java marshallers to and from bson. Currently used in a data access
layer serialize Json to Bson for MongoDB storage.
package com.jrodeo.bson.marshallers;
import org.bson.BsonReader;
import org.bson.BsonWriter;
/**
* * A hand coded Marshaller
to serialize java.lang.String
.
*/
public class StringMarshaller extends AbstractSimpleMarshaller {
@Override
public Class getForClass() {
return String.class;
}
@Override
public void write(BsonWriter writer, String obj) {
writer.writeString(obj);
}
@Override
public String read(BsonReader reader) {
String result = reader.readString();
return result;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy