public class JsonSchemaGeneratorSession extends BeanTraverseSession
JsonSchemaSerializer
.
This class is NOT thread safe. It is typically discarded after one-time use although it can be reused within the same thread.
indent
Modifier | Constructor and Description |
---|---|
protected |
JsonSchemaGeneratorSession(JsonSchemaGenerator ctx,
BeanSessionArgs args)
Create a new session using properties specified in the context.
|
Modifier and Type | Method and Description |
---|---|
JsonSchemaGeneratorSession |
addBeanDef(String id,
ObjectMap def)
Adds a schema definition to this session.
|
protected Set<TypeCategory> |
getAddDescriptionsTo()
Configuration property: Add descriptions to types.
|
protected Set<TypeCategory> |
getAddExamplesTo()
Configuration property: Add examples.
|
String |
getBeanDefId(ClassMeta<?> cm)
Returns the definition ID for the specified class.
|
protected BeanDefMapper |
getBeanDefMapper()
Configuration property: Bean schema definition mapper.
|
Map<String,ObjectMap> |
getBeanDefs()
Returns the definitions that were gathered during this session.
|
URI |
getBeanDefUri(ClassMeta<?> cm)
Returns the definition URI for the specified class.
|
URI |
getBeanDefUri(String id)
Returns the definition URI for the specified class.
|
protected Map<String,ObjectMap> |
getDefaultSchemas()
Configuration property: Default schemas.
|
protected Set<Pattern> |
getIgnoreTypes()
Configuration property: Ignore types from schema definitions.
|
JsonSchemaBeanPropertyMeta |
getJsonSchemaBeanPropertyMeta(BeanPropertyMeta bpm)
Returns the language-specific metadata on the specified bean property.
|
JsonSchemaClassMeta |
getJsonSchemaClassMeta(ClassMeta<?> cm)
Returns the language-specific metadata on the specified class.
|
ObjectMap |
getSchema(ClassMeta<?> cm)
Returns the JSON-schema for the specified type.
|
ObjectMap |
getSchema(Object o)
Returns the JSON-schema for the specified object.
|
ObjectMap |
getSchema(Type type)
Returns the JSON-schema for the specified type.
|
protected boolean |
isAllowNestedDescriptions()
Configuration property: Allow nested descriptions.
|
protected boolean |
isAllowNestedExamples()
Configuration property: Allow nested examples.
|
protected boolean |
isUseBeanDefs()
Configuration property: Use bean definitions.
|
ObjectMap |
toMap()
Returns the properties defined on this bean context as a simple map for debugging purposes.
|
getInitialDepth, getLastLocation, getMaxDepth, getOptionalType, getOptionalValue, getStack, isDetectRecursions, isIgnoreRecursions, isOptional, onError, pop, push, setCurrentClass, setCurrentProperty, willRecurse
_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 JsonSchemaGeneratorSession(JsonSchemaGenerator ctx, BeanSessionArgs args)
ctx
- The context creating this session object.
The context contains all the configuration settings for this object.args
- Runtime arguments.
These specify session-level information such as locale and URI context.
It also include session-level properties that override the properties defined on the bean and
serializer contexts.public ObjectMap getSchema(Object o) throws BeanRecursionException, SerializeException
o
- The object.
BeanRecursionException
- Bean recursion occurred.SerializeException
- Error occurred.public ObjectMap getSchema(Type type) throws BeanRecursionException, SerializeException
type
- The object type.BeanRecursionException
- Bean recursion occurred.SerializeException
- Error occurred.public ObjectMap getSchema(ClassMeta<?> cm) throws BeanRecursionException, SerializeException
cm
- The object type.BeanRecursionException
- Bean recursion occurred.SerializeException
- Error occurred.public String getBeanDefId(ClassMeta<?> cm)
cm
- The class to get the definition ID of.public URI getBeanDefUri(ClassMeta<?> cm)
cm
- The class to get the definition URI of.public URI getBeanDefUri(String id)
id
- The definition ID to get the definition URI of.public Map<String,ObjectMap> getBeanDefs()
This map is modifiable and affects the map in the session.
JsonSchemaGenerator.JSONSCHEMA_useBeanDefs
was not enabled.public JsonSchemaGeneratorSession addBeanDef(String id, ObjectMap def)
id
- The definition ID.def
- The definition schema.protected final Set<TypeCategory> getAddDescriptionsTo()
JsonSchemaGenerator.JSONSCHEMA_addDescriptionsTo
protected final Set<TypeCategory> getAddExamplesTo()
JsonSchemaGenerator.JSONSCHEMA_addExamplesTo
protected final boolean isAllowNestedDescriptions()
JsonSchemaGenerator.JSONSCHEMA_allowNestedDescriptions
protected final boolean isAllowNestedExamples()
JsonSchemaGenerator.JSONSCHEMA_allowNestedExamples
protected final BeanDefMapper getBeanDefMapper()
JsonSchemaGenerator.JSONSCHEMA_beanDefMapper
protected final Map<String,ObjectMap> getDefaultSchemas()
JsonSchemaGenerator.JSONSCHEMA_defaultSchemas
protected final Set<Pattern> getIgnoreTypes()
JsonSchemaGenerator.JSONSCHEMA_ignoreTypes
protected final boolean isUseBeanDefs()
JsonSchemaGenerator.JSONSCHEMA_useBeanDefs
public JsonSchemaClassMeta getJsonSchemaClassMeta(ClassMeta<?> cm)
cm
- The class to return the metadata on.public JsonSchemaBeanPropertyMeta getJsonSchemaBeanPropertyMeta(BeanPropertyMeta bpm)
bpm
- The bean property to return the metadata on.public ObjectMap toMap()
Session
toMap
in class BeanTraverseSession
Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.