public final class JsonParserSession extends ReaderParserSession
JsonParser
.
This class is NOT thread safe. It is typically discarded after one-time use although it can be reused against multiple inputs.
Modifier | Constructor and Description |
---|---|
protected |
JsonParserSession(JsonParser ctx,
ParserSessionArgs args)
Create a new session using properties specified in the context.
|
Modifier and Type | Method and Description |
---|---|
protected <T> T |
doParse(ParserPipe pipe,
ClassMeta<T> type)
Workhorse method.
|
protected <E> Collection<E> |
doParseIntoCollection(ParserPipe pipe,
Collection<E> c,
Type elementType)
Implementation method.
|
protected <K,V> Map<K,V> |
doParseIntoMap(ParserPipe pipe,
Map<K,V> m,
Type keyType,
Type valueType)
Implementation method.
|
protected JsonClassMeta |
getJsonClassMeta(ClassMeta<?> cm)
Returns the language-specific metadata on the specified class.
|
protected boolean |
isCommentOrWhitespace(int cp)
Returns
|
protected boolean |
isValidateEnd()
Configuration property: Validate end.
|
protected boolean |
isWhitespace(int cp)
Returns
|
ObjectMap |
toMap()
Returns the properties defined on this bean context as a simple map for debugging purposes.
|
createPipe, getFileCharset, getStreamCharset, isReaderParser
cast, convertAttrToType, getClassMeta, getDebugOutputLines, getInputAsString, getJavaMethod, getLastLocation, getListener, getListener, getListenerClass, getOuter, getPosition, isAutoCloseStreams, isStrict, isTrimStrings, isUnbuffered, mark, onUnknownProperty, parse, parse, parse, parse, parse, parse, parseArgs, parseIntoCollection, parseIntoMap, setCurrentClass, setCurrentProperty, setName, setParent, setPipe, trim, trim, unmark, unswap
_class, checkForWarnings, convertToMemberType, convertToMemberType, convertToType, convertToType, convertToType, getArgsClassMeta, getBeanClassVisibility, getBeanConstructorVisibility, getBeanDictionaryClasses, getBeanFieldVisibility, getBeanFilters, getBeanMeta, getBeanMethodVisibility, getBeanRegistry, getBeanTypePropertyName, getBeanTypePropertyName, getBpi, getBpro, getBpwo, getBpx, getClassMeta, getClassMeta, getClassMetaForObject, getClassMetaForObject, getExamples, getImplClasses, getLocale, getMediaType, getNotBeanClasses, getNotBeanPackagesNames, getNotBeanPackagesPrefixes, getPojoSwaps, getPropertyNamer, getSchema, getStringBuilder, getTimeZone, getTimeZoneId, isBean, isBean, isBeanMapPutReturnsOldValue, isBeansRequireDefaultConstructor, isBeansRequireSerializable, isBeansRequireSettersForGetters, isBeansRequireSomeProperties, isDebug, isFluentSetters, isIgnoreInvocationExceptionsOnGetters, isIgnoreInvocationExceptionsOnSetters, isIgnorePropertiesWithoutSetters, isIgnoreUnknownBeanProperties, isIgnoreUnknownNullBeanProperties, isSortProperties, isUseEnumNames, isUseInterfaceProxies, isUseJavaBeanIntrospector, newBean, newBean, newBeanMap, newBeanMap, object, returnStringBuilder, string, toArray, toBeanMap, toBeanMap
addToCache, addToCache, addWarning, getClassProperty, getFromCache, getInstanceArrayProperty, getInstanceProperty, getLogger, getProperties, getProperty, getProperty, getProperty, getPropertyKeys, getWarnings, hasProperty, hasWarnings, toString
protected JsonParserSession(JsonParser ctx, ParserSessionArgs args)
ctx
- The context creating this session object.
The context contains all the configuration settings for this object.args
- Runtime session arguments.protected final boolean isWhitespace(int cp)
The definition of whitespace is different for strict vs lax mode.
Strict mode only interprets 0x20 (space), 0x09 (tab), 0x0A (line feed) and 0x0D (carriage return) as whitespace.
Lax mode uses Character.isWhitespace(int)
to make the determination.
cp
- The codepoint.protected final boolean isCommentOrWhitespace(int cp)
cp
- The codepoint.protected <T> T doParse(ParserPipe pipe, ClassMeta<T> type) throws IOException, ParseException, ExecutableException
ParserSession
Subclasses are expected to implement this method.
doParse
in class ParserSession
T
- The class type of the object to create.pipe
- Where to get the input from.type
- The class type of the object to create.
If Object.class
, object type is based on what's being parsed.
For example, when parsing JSON text, it may return a IOException
- Thrown by underlying stream.ParseException
- Malformed input encountered.ExecutableException
- Exception occurred on invoked constructor/method/field.protected <K,V> Map<K,V> doParseIntoMap(ParserPipe pipe, Map<K,V> m, Type keyType, Type valueType) throws IOException, ParseException, ExecutableException
ParserSession
Default implementation throws an UnsupportedOperationException
.
doParseIntoMap
in class ParserSession
pipe
- The parser input.m
- The map being loaded.keyType
- The class type of the keys, or String.class
.valueType
- The class type of the values, or IOException
ParseException
ExecutableException
protected <E> Collection<E> doParseIntoCollection(ParserPipe pipe, Collection<E> c, Type elementType) throws IOException, ParseException, ExecutableException
ParserSession
Default implementation throws an UnsupportedOperationException
.
doParseIntoCollection
in class ParserSession
pipe
- The parser input.c
- The collection being loaded.elementType
- The class type of the elements, or IOException
ParseException
ExecutableException
protected final boolean isValidateEnd()
JsonParser.JSON_validateEnd
protected JsonClassMeta getJsonClassMeta(ClassMeta<?> cm)
cm
- The class to return the metadata on.public ObjectMap toMap()
Session
toMap
in class ReaderParserSession
Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.