Java Code Examples for org.bson.BsonWriter#writeInt32()

The following examples show how to use org.bson.BsonWriter#writeInt32() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CollectionStatsCodec.java    From morphia with Apache License 2.0 6 votes vote down vote up
@Override
protected void encodeStage(final BsonWriter writer, final CollectionStats value, final EncoderContext encoderContext) {
    writer.writeStartDocument();
    if (value.getHistogram()) {
        writer.writeStartDocument("latencyStats");
        writer.writeBoolean("histograms", true);
        writer.writeEndDocument();
    }
    if (value.getScale() != null) {
        writer.writeStartDocument("storageStats");
        writer.writeInt32("scale", value.getScale());
        writer.writeEndDocument();
    }
    if (value.getCount()) {
        writer.writeStartDocument("count");
        writer.writeEndDocument();
    }
    writer.writeEndDocument();
}
 
Example 2
Source File: RangeExpression.java    From morphia with Apache License 2.0 5 votes vote down vote up
@Override
public void encode(final Mapper mapper, final BsonWriter writer, final EncoderContext encoderContext) {
    writer.writeStartDocument();
    writer.writeStartArray(getOperation());
    writer.writeInt32(start);
    writer.writeInt32(end);
    if (step != null) {
        writer.writeInt32(step);
    }
    writer.writeEndArray();
    writer.writeEndDocument();
}
 
Example 3
Source File: SliceExpression.java    From morphia with Apache License 2.0 5 votes vote down vote up
@Override
public void encode(final Mapper mapper, final BsonWriter writer, final EncoderContext encoderContext) {
    writer.writeStartDocument();
    writer.writeStartArray(getOperation());
    writeUnnamedExpression(mapper, writer, array, encoderContext);
    if (position != null) {
        writer.writeInt32(position);
    }
    writer.writeInt32(size);
    writer.writeEndArray();
    writer.writeEndDocument();
}
 
Example 4
Source File: AbstractJsonCodec.java    From vertx-mongo-client with Apache License 2.0 4 votes vote down vote up
protected void writeInt32(BsonWriter writer, String name, Object value, EncoderContext ctx) {
  writer.writeInt32((int) value);
}
 
Example 5
Source File: Sort.java    From morphia with Apache License 2.0 4 votes vote down vote up
@Override
public void encode(final BsonWriter writer) {
    writer.writeInt32(1);
}
 
Example 6
Source File: Sort.java    From morphia with Apache License 2.0 4 votes vote down vote up
@Override
public void encode(final BsonWriter writer) {
    writer.writeInt32(-1);
}