Class Json5lParserSession
- All Implemented Interfaces:
BeanSession,ConverterSession,ArrayRecordReadable,RecordReadable,TokenReadable
Json5lParser.
Extends Json5ParserSession to inherit the full JSON5 dialect (single-quoted strings,
bare/unquoted field names, trailing commas, missing values, comments, relaxed numbers) and
re-adds JSONL's newline-delimited framing: input is read one line at a time, blank and
comment-only lines are skipped, and each remaining line is parsed as one JSON5 value.
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.json.JsonParserSession
JsonParserSession.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 Json5lParserSession.Buildercreate(Json5lParser ctx) Creates a new builder for this object.protected <T> TdoRead(ParserPipe pipe, ClassMeta<T> type) Workhorse method.readArrayRecords(Object input) Streaming array-elementRecordReaderfor JSON5L.readTokens(Object input) Opens a low-level pull-parser cursor over a JSON5L document, bound to this live session.Methods inherited from class org.apache.juneau.marshall.json5.Json5ParserSession
allowsTrailingComma, canCoerceNonStringToString, create, isCommentOrWhitespace, isNumberStartChar, isWhitespace, newGenericList, newGenericMap, onEmptyInput, onMissingValue, readFieldName, readNumber, readNumber, readString, skipCommentsAndSpaceMethods inherited from class org.apache.juneau.marshall.json.JsonParserSession
create, doReadIntoCollection, doReadIntoMap, getJsonClassMeta, isValidateEnd, readKeyword, skipCommentsMethods 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, 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
isArrayRecordStreaming, readArrayRecordsMethods inherited from interface org.apache.juneau.commons.conversion.ConverterSession
getMethods inherited from interface org.apache.juneau.marshall.stream.RecordReadable
isRecordStreamingMethods inherited from interface org.apache.juneau.marshall.stream.TokenReadable
readRecords
-
Constructor Details
-
Json5lParserSession
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.- Returns:
- A new builder.
-
readTokens
Opens a low-level pull-parser cursor over a JSON5L document, bound to this live session.Each top-level JSON5 value (one per line) is emitted as a flat sequence at depth 0; there is no virtual root container. Same honored/ignored builder properties as
Json5ParserSession.readTokens(Object).- Specified by:
readTokensin interfaceTokenReadable- Overrides:
readTokensin classJson5ParserSession- Parameters:
input- The input. AcceptsReader,CharSequence,InputStream, or.byte []- Returns:
- A new
Json5lTokenReader. - Throws:
IOException- If a problem occurred opening the underlying input.
-
readArrayRecords
Streaming array-elementRecordReaderfor JSON5L.Aliases the JSON5L line record stream: the
Json5lTokenReaderreturned byreadTokens(Object)is itself aRecordReaderthat yields one record per top-level line at depth 0. Memory is O(1) in the number of lines.- Specified by:
readArrayRecordsin interfaceArrayRecordReadable- Overrides:
readArrayRecordsin classJsonParserSession- Parameters:
input- The input.- Returns:
- A new line-delimited
RecordReader. - Throws:
IOException- If a problem occurred opening the underlying input.
-
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 classJsonParserSession- 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.
-