Package org.apache.juneau.marshall.bson
Class BsonSerializerSession
java.lang.Object
org.apache.juneau.marshall.ContextSession
org.apache.juneau.marshall.MarshallingSession
org.apache.juneau.marshall.MarshallingTraverseSession
org.apache.juneau.marshall.serializer.SerializerSession
org.apache.juneau.marshall.serializer.OutputStreamSerializerSession
org.apache.juneau.marshall.bson.BsonSerializerSession
- All Implemented Interfaces:
BeanSession,ConverterSession,ArrayRecordWritable,RecordWritable
public class BsonSerializerSession
extends OutputStreamSerializerSession
implements RecordWritable, ArrayRecordWritable
Session object that lives for the duration of a single use of
BsonSerializer.
Notes:
- This class is not thread safe and is typically discarded after one use.
See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.apache.juneau.marshall.serializer.OutputStreamSerializerSession
OutputStreamSerializerSession.DefaultBuilder -
Field Summary
Fields inherited from class org.apache.juneau.marshall.MarshallingTraverseSession
indentFields inherited from class org.apache.juneau.marshall.MarshallingSession
NAME_PROPERTY_NAME -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected -
Method Summary
Modifier and TypeMethodDescriptioncreate(BsonSerializer ctx) Creates a new builder for this object.protected voiddoWrite(SerializerPipe out, Object o) Serializes a POJO to the specified pipe.booleanThe BSON array-record writer is buffered/RecordAdapter-backed, not O(1) streaming.booleanThe BSON record writer is buffered/RecordAdapter-backed, not O(1) streaming.writeArrayRecords(Object output) Buffered array-elementRecordWriterfor BSON, bound to this live session.writeRecords(Object output) Opens a whole-value push generator targeting BSON output, bound to this live session.Methods inherited from class org.apache.juneau.marshall.serializer.OutputStreamSerializerSession
create, createPipe, getBinaryFormat, hasNativeBytes, isWriterSerializer, write, writeToStringMethods inherited from class org.apache.juneau.marshall.serializer.SerializerSession
addVarBean, canIgnoreValue, canIgnoreValue, create, createBeanTypeNameProperty, createDefaultVarResolverSession, forEachEntry, forEachEntry, forEachStreamableEntry, generalize, getBeanTypeName, getCalendarFormat, getDateFormat, getDurationFormat, getExpectedRootType, getJavaMethod, getListener, getListener, getLocaleFormat, getPeriodFormat, getResponseHeaders, getSchema, getTemporalFormat, getTimeZoneFormat, getUriContext, getUriRelativity, getUriResolution, getUriResolver, getVarResolver, handleThrown, isAddBeanTypes, isAddRootType, isKeepNullProperties, isNonDefault, isSortCollections, isSortMaps, isTrimEmptyCollections, isTrimEmptyMaps, isTrimStrings, onBeanGetterException, onError, properties, push2, relativizeUri, resolve, resolveUri, sort, sort, sort, swap, toList, toListFromStreamable, toString, trim, unwrapSupplier, write, writeCalendar, writeDate, writeDuration, writePeriod, writeTemporalMethods inherited from class org.apache.juneau.marshall.MarshallingTraverseSession
getInitialDepth, getLastLocation, getMaxDepth, getOptionalType, getOptionalValue, getStack, isDetectRecursions, isIgnoreRecursions, isOptional, isRoot, pop, push, setCurrentClass, setCurrentProperty, willExceedDepth, willRecurseMethods inherited from class org.apache.juneau.marshall.MarshallingSession
addWarning, convertToMemberType, convertToMemberType, convertToMemberType, convertToType, convertToType, convertToType, convertToType, create, get, getActiveView, getAnnotationProvider, getArgsClassMeta, getBeanClassVisibility, getBeanConstructorVisibility, getBeanDictionary, getBeanFieldVisibility, getBeanMeta, getBeanMethodVisibility, getBeanRegistry, getBeanTypePropertyName, getBeanTypePropertyName, getClassLoader, getClassMeta, getClassMeta, getClassMetaForObject, getClassMetaForObject, getLocale, getMarshallingContext, getMediaType, getNotBeanClasses, getNotBeanPackagesNames, getPropertyNamer, getSwaps, getTimeZone, getTimeZoneId, isBean, isBean, isBeanMapPutReturnsOldValue, isBeansRequireDefaultConstructor, isBeansRequireSerializable, isBeansRequireSettersForGetters, isBeansRequireSomeProperties, isFindFluentSetters, isIgnoreInvocationExceptionsOnGetters, isIgnoreInvocationExceptionsOnSetters, isIgnoreMissingSetters, isIgnoreUnknownBeanProperties, isIgnoreUnknownNullBeanProperties, isPropertyInActiveView, isRecordComponentOrder, isUnsortedProperties, isUseInterfaceProxies, isUseJavaBeanIntrospector, isValidateSchema, newBean, newBean, newBeanMap, newBeanMap, newGenericList, newGenericMap, newGenericMap, object, parseToList, parseToMap, string, toArray, toBeanMap, toBeanMap, toBeanMapMethods inherited from class org.apache.juneau.marshall.ContextSession
checkForWarnings, getContext, getSessionProperties, getWarnings, isDebug, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.juneau.marshall.stream.ArrayRecordWritable
writeArrayRecordsMethods inherited from interface org.apache.juneau.commons.conversion.ConverterSession
get
-
Constructor Details
-
BsonSerializerSession
-
-
Method Details
-
create
Creates a new builder for this object.- Parameters:
ctx- The context creating this session.
Cannot benull .- Returns:
- A new builder.
-
writeRecords
Opens a whole-value push generator targeting BSON output, bound to this live session.write(Object)delegates toSerializerSession.write(Object, Object).- Specified by:
writeRecordsin interfaceRecordWritable- Parameters:
output- The output.- Returns:
- A new
RecordWriter. - Throws:
IOException- If a problem occurred opening the underlying output.
-
writeArrayRecords
Buffered array-elementRecordWriterfor BSON, bound to this live session. BSON's wire format requires the entire document byte-length up front (length prefix at every nesting level), so streaming without buffering is not possible.- Specified by:
writeArrayRecordsin interfaceArrayRecordWritable- Parameters:
output- The output.- Returns:
- A buffered
RecordWriter. - Throws:
IOException- If a problem occurred opening the underlying output.
-
isRecordStreaming
The BSON record writer is buffered/RecordAdapter-backed, not O(1) streaming.- Specified by:
isRecordStreamingin interfaceRecordWritable- Returns:
- Always
false .
-
isArrayRecordStreaming
The BSON array-record writer is buffered/RecordAdapter-backed, not O(1) streaming.- Specified by:
isArrayRecordStreamingin interfaceArrayRecordWritable- Returns:
- Always
false .
-
doWrite
Description copied from class:SerializerSessionSerializes a POJO to the specified pipe.This method should NOT close the context object.
The default implementation of this method simply calls
Serializer.doWrite(SerializerSession,SerializerPipe,Object).- Overrides:
doWritein classSerializerSession- Parameters:
out- Where to send the output from the serializer.o- The object to serialize.- Throws:
IOException- Thrown by underlying stream.SerializeException- Problem occurred trying to serialize object.
-