Class JsonSchemaGeneratorSession
java.lang.Object
org.apache.juneau.marshall.ContextSession
org.apache.juneau.marshall.MarshallingSession
org.apache.juneau.marshall.MarshallingTraverseSession
org.apache.juneau.marshall.jsonschema.JsonSchemaGeneratorSession
- All Implemented Interfaces:
BeanSession,ConverterSession
Session object that lives for the duration of a single use of
JsonSchemaSerializer.
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.MarshallingSession
MarshallingSession.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
ConstructorsModifierConstructorDescriptionprotectedConstructor. -
Method Summary
Modifier and TypeMethodDescriptionaddBeanDef(String id, JsonMap def) Adds a schema definition to this session.Creates a new builder for this object.protected final Set<TypeCategory>Add descriptions to types.protected final Set<TypeCategory>Add examples.getBeanDefId(ClassMeta<?> cm) Returns the definition ID for the specified class.protected final MarshallingDefMapperBean schema definition mapper.Returns the definitions that were gathered during this session.getBeanDefUri(String id) Returns the definition URI for the specified class.getBeanDefUri(ClassMeta<?> cm) Returns the definition URI for the specified class.Ignore types from schema definitions.Returns the language-specific metadata on the specified bean property.getJsonSchemaClassMeta(ClassMeta<?> cm) Returns the language-specific metadata on the specified class.Returns the JSON-schema for the specified object.Returns the JSON-schema for the specified type.Returns the JSON-schema for the specified type.protected final booleanAllow nested descriptions.protected final booleanAllow nested examples.protected final booleanUse bean definitions.Methods inherited from class org.apache.juneau.marshall.MarshallingTraverseSession
getInitialDepth, getLastLocation, getMaxDepth, getOptionalType, getOptionalValue, getStack, isDetectRecursions, isIgnoreRecursions, isOptional, isRoot, onError, pop, properties, 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.commons.conversion.ConverterSession
get
-
Constructor Details
-
JsonSchemaGeneratorSession
Constructor.- Parameters:
builder- The builder for this object. Cannot benull .
-
-
Method Details
-
create
Creates a new builder for this object.- Parameters:
ctx- The context creating this session.
Cannot benull .- Returns:
- A new builder.
-
addBeanDef
Adds a schema definition to this session.- Parameters:
id- The definition ID.
Cannot benull .def- The definition schema.
Cannot benull .- Returns:
- This object.
-
getBeanDefId
Returns the definition ID for the specified class.- Parameters:
cm- The class to get the definition ID of. Must not benull .- Returns:
- The definition ID for the specified class.
-
getBeanDefs
Returns the definitions that were gathered during this session.This map is modifiable and affects the map in the session.
- Returns:
- The definitions that were gathered during this session, or
null ifJsonSchemaGenerator.Builder.useBeanDefs()was not enabled.
-
getBeanDefUri
Returns the definition URI for the specified class.- Parameters:
cm- The class to get the definition URI of. Must not benull .- Returns:
- The definition URI for the specified class.
-
getBeanDefUri
Returns the definition URI for the specified class.- Parameters:
id- The definition ID to get the definition URI of.- Returns:
- The definition URI for the specified class.
-
getJsonSchemaBeanPropertyMeta
Returns the language-specific metadata on the specified bean property.- Parameters:
bpm- The bean property to return the metadata on. Must not benull .- Returns:
- The metadata.
-
getJsonSchemaClassMeta
Returns the language-specific metadata on the specified class.- Parameters:
cm- The class to return the metadata on. Must not benull .- Returns:
- The metadata.
-
getSchema
Returns the JSON-schema for the specified type.- Parameters:
cm- The object type.- Returns:
- The schema for the type, or
null if the type is ignored (seeJsonSchemaGenerator.Builder.ignoreTypes(String...)). - Throws:
MarshallingRecursionException- Bean recursion occurred.SerializeException- Error occurred.
-
getSchema
Returns the JSON-schema for the specified object.- Parameters:
o- The object.
Can either be a POJO or aClass /Type .- Returns:
- The schema for the type, or
null if the type is ignored (seeJsonSchemaGenerator.Builder.ignoreTypes(String...)). - Throws:
MarshallingRecursionException- Bean recursion occurred.SerializeException- Error occurred.
-
getSchema
Returns the JSON-schema for the specified type.- Parameters:
type- The object type.- Returns:
- The schema for the type, or
null if the type is ignored (seeJsonSchemaGenerator.Builder.ignoreTypes(String...)). - Throws:
MarshallingRecursionException- Bean recursion occurred.SerializeException- Error occurred.
-
getAddDescriptionsTo
Add descriptions to types.- Returns:
- Set of categories of types that descriptions should be automatically added to generated schemas.
- See Also:
-
getAddExamplesTo
Add examples.- Returns:
- Set of categories of types that examples should be automatically added to generated schemas.
- See Also:
-
getBeanDefMapper
Bean schema definition mapper.- Returns:
- Interface to use for converting Bean classes to definition IDs and URIs.
- See Also:
-
getIgnoreTypes
Ignore types from schema definitions.- Returns:
- Custom schema information for particular class types.
- See Also:
-
isAllowNestedDescriptions
Allow nested descriptions.- Returns:
true if nested descriptions are allowed in schema definitions.- See Also:
-
isAllowNestedExamples
Allow nested examples.- Returns:
true if nested examples are allowed in schema definitions.- See Also:
-
isUseBeanDefs
Use bean definitions.- Returns:
true if schemas on beans will be serialized with'$ref' tags.- See Also:
-