本文整理汇总了Java中org.bson.BsonWriter.writeString方法的典型用法代码示例。如果您正苦于以下问题:Java BsonWriter.writeString方法的具体用法?Java BsonWriter.writeString怎么用?Java BsonWriter.writeString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bson.BsonWriter
的用法示例。
在下文中一共展示了BsonWriter.writeString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: encode
import org.bson.BsonWriter; //导入方法依赖的package包/类
@Override
public void encode(BsonWriter writer, T value, EncoderContext encoderContext) {
if (value == null) {
writer.writeNull();
}
else {
writer.writeStartDocument();
PolymorphicCodec<T> codecForValue = getCodecForClass(value.getClass());
if (codecForValue != null) {
writer.writeName(discriminatorKeys.get(codecForValue.getEncoderClass()));
writer.writeString(mainDiscriminators.get(codecForValue.getEncoderClass()));
codecForValue.encodeFields(writer, value, encoderContext);
} else {
LOGGER.warn("The value to be encoded has the wrong type {}. This codec can only handle {}", value.getClass(), discriminatorToCodec);
}
writer.writeEndDocument();
}
}
示例2: encode
import org.bson.BsonWriter; //导入方法依赖的package包/类
@Override
public void encode(
BsonWriter writer,
Period value,
EncoderContext encoderContext) {
writer.writeString(value.toString());
}
示例3: encode
import org.bson.BsonWriter; //导入方法依赖的package包/类
@Override
public void encode(
BsonWriter writer,
OffsetTime value,
EncoderContext encoderContext) {
writer.writeString(value.toString());
}
示例4: encode
import org.bson.BsonWriter; //导入方法依赖的package包/类
@Override
public void encode(
BsonWriter writer,
ZonedDateTime value,
EncoderContext encoderContext) {
writer.writeString(value.toString());
}
示例5: encode
import org.bson.BsonWriter; //导入方法依赖的package包/类
@Override
public void encode(
BsonWriter writer,
OffsetDateTime value,
EncoderContext encoderContext) {
writer.writeString(value.toString());
}
示例6: encode
import org.bson.BsonWriter; //导入方法依赖的package包/类
@Override
public void encode(BsonWriter writer, Set<String> value, EncoderContext encoderContext) {
StringBuilder sb = new StringBuilder();
for (String s : value) {
sb.append(s).append('#');
}
writer.writeString(sb.toString());
}
示例7: encode
import org.bson.BsonWriter; //导入方法依赖的package包/类
@Override
public void encode(BsonWriter writer, T value, EncoderContext encoderContext) {
writer.writeString(value.name());
}
示例8: encode
import org.bson.BsonWriter; //导入方法依赖的package包/类
@Override
public void encode(BsonWriter bsonWriter, CustomId customId, EncoderContext encoderContext) {
bsonWriter.writeString(customId.getAStringProperty());
}
示例9: encode
import org.bson.BsonWriter; //导入方法依赖的package包/类
@Override
public void encode(BsonWriter bsonWriter, String value) {
bsonWriter.writeString(value);
}