Class YamlParserSession
- All Implemented Interfaces:
BeanSession,ConverterSession,ArrayRecordReadable,RecordReadable
YamlParser.
Notes:
- This class is not thread safe and is typically discarded after one use.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.apache.juneau.marshall.parser.ReaderParserSession
ReaderParserSession.DefaultBuilder -
Field Summary
Fields inherited from class org.apache.juneau.marshall.parser.ParserSession
DEFAULT_MAX_PARSE_DEPTHFields inherited from class org.apache.juneau.marshall.MarshallingSession
NAME_PROPERTY_NAME -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic YamlParserSession.Buildercreate(YamlParser ctx) Creates a new builder for this object.protected <T> TdoRead(ParserPipe pipe, ClassMeta<T> type) Workhorse method.protected <E> Collection<E>doReadIntoCollection(ParserPipe pipe, Collection<E> c, Type elementType) Implementation method.protected <K,V> Map<K, V> doReadIntoMap(ParserPipe pipe, Map<K, V> m, Type keyType, Type valueType) Implementation method.booleanThe YAML array-record cursor is buffered/RecordAdapter-backed, not O(1) streaming.booleanThe YAML record cursor is buffered/RecordAdapter-backed, not O(1) streaming.readArrayRecords(Object input) Buffered array-elementRecordReaderfor YAML, bound to this live session.readRecords(Object input) Opens a whole-value pull-parser cursor over a YAML document, bound to this live session.Methods inherited from class org.apache.juneau.marshall.parser.ReaderParserSession
create, createPipe, getStreamCharset, isReaderParser, propertiesMethods inherited from class org.apache.juneau.marshall.parser.ParserSession
allocateLocal, cast, checkRequired, convertAttrToType, create, doReadToBeanConsumer, enterParseDepth, exitParseDepth, getCalendarFormat, getClassMeta, getDateFormat, getDebugOutputLines, getDurationFormat, getInputAsString, getJavaMethod, getLastLocation, getListener, getListener, getListenerClass, getLocaleFormat, getNulls, getOuter, getPeriodFormat, getPosition, getSchema, getStringBuilder, getTemporalFormat, getTimeZoneFormat, isAutoCloseStreams, isTrimStrings, isUnbuffered, mark, onBeanSetterException, onUnknownProperty, parentBean, read, read, read, read, read, read, readArgs, readCalendar, readDate, readDuration, readIntoCollection, readIntoMap, readPeriod, readTemporal, readToBeanConsumer, returnStringBuilder, setCurrentClass, setCurrentProperty, setName, setParent, setPipe, swapParentBean, trim, trim, unmark, unswapMethods 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.ArrayRecordReadable
readArrayRecordsMethods inherited from interface org.apache.juneau.commons.conversion.ConverterSession
get
-
Constructor Details
-
YamlParserSession
Constructor.- Parameters:
builder- The builder for this object.
-
-
Method Details
-
create
Creates a new builder for this object.- Parameters:
ctx- The context creating this session.
Cannot benull .- Returns:
- A new builder.
-
doRead
protected <T> T doRead(ParserPipe pipe, ClassMeta<T> type) throws IOException, ParseException, ExecutableException Description copied from class:ParserSessionWorkhorse method.Subclasses are expected to implement this method or
Parser.doRead(ParserSession,ParserPipe,ClassMeta).The default implementation of this method simply calls
Parser.doRead(ParserSession,ParserPipe,ClassMeta).- Overrides:
doReadin classParserSession- Type Parameters:
T- The class type of the object to create.- Parameters:
pipe- Where to get the input from.type- The class type of the object to create. Ifnull orObject., object type is based on what's being parsed. For example, when parsing JSON text, it may return aclass String ,Number ,JsonMap , etc...- Returns:
- The parsed object.
- Throws:
IOException- Thrown by underlying stream.ParseException- Malformed input encountered.ExecutableException- Exception occurred on invoked constructor/method/field.
-
readRecords
Opens a whole-value pull-parser cursor over a YAML document, bound to this live session.read(...)delegates to the polymorphicParserSession.read(Object, Class)entry point.- Specified by:
readRecordsin interfaceRecordReadable- Parameters:
input- The input.- Returns:
- A new
RecordReadercursor. - Throws:
IOException- If a problem occurred opening the underlying input.
-
readArrayRecords
Buffered array-elementRecordReaderfor YAML, bound to this live session. Callsparse(input, List.class, Object.class)once and iterates the result.Streaming status:
A top-level YAML block sequence (
- elemper line) is forward-readable in principle, so true element-at-a-time streaming is feasible here (unlike Parquet/BSON). It is left buffered for now: Juneau's YAML reader is a single hand-written indentation state machine (readBlockSequence/readFlowSequence) whose per-element advance and dedent bookkeeping are not currently exposed as a pull cursor, and extracting that safely is a non-trivial parser refactor with real regression surface. This is demand-driven — convert when a large-YAML-array use case justifies the refactor.- Specified by:
readArrayRecordsin interfaceArrayRecordReadable- Parameters:
input- The input.- Returns:
- A buffered
RecordReader. - Throws:
IOException- If a problem occurred reading the input.
-
isRecordStreaming
The YAML record cursor is buffered/RecordAdapter-backed, not O(1) streaming.- Specified by:
isRecordStreamingin interfaceRecordReadable- Returns:
- Always
false .
-
isArrayRecordStreaming
The YAML array-record cursor is buffered/RecordAdapter-backed, not O(1) streaming.Genuine streaming is feasible for YAML block sequences but deferred (demand-driven) pending a pull-cursor refactor of the indentation state machine; see
readArrayRecords(Object).- Specified by:
isArrayRecordStreamingin interfaceArrayRecordReadable- Returns:
- Always
false .
-
doReadIntoCollection
protected <E> Collection<E> doReadIntoCollection(ParserPipe pipe, Collection<E> c, Type elementType) throws IOException, ParseException, ExecutableException Description copied from class:ParserSessionImplementation method.Default implementation throws an
UnsupportedOperationException.- Overrides:
doReadIntoCollectionin classParserSession- Type Parameters:
E- The element type.- Parameters:
pipe- The parser input.c- The collection being loaded.elementType- The class type of the elements, ornull to default to whatever is being parsed.- Returns:
- The same collection that was passed in to allow this method to be chained.
- Throws:
IOExceptionParseExceptionExecutableException
-
doReadIntoMap
protected <K,V> Map<K,V> doReadIntoMap(ParserPipe pipe, Map<K, V> m, Type keyType, Type valueType) throws IOException, ParseException, ExecutableExceptionDescription copied from class:ParserSessionImplementation method.Default implementation throws an
UnsupportedOperationException.- Overrides:
doReadIntoMapin classParserSession- Type Parameters:
K- The key type.V- The value type.- Parameters:
pipe- The parser input.m- The map being loaded.keyType- The class type of the keys, ornull to default toString..class valueType- The class type of the values, ornull to default to whatever is being parsed.- Returns:
- The same map that was passed in to allow this method to be chained.
- Throws:
IOExceptionParseExceptionExecutableException
-