Class TypeScope
java.lang.Object
com.github.victools.jsonschema.generator.TypeScope
- Direct Known Subclasses:
MemberScope
Representation of a single type to represent as (sub) schema.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTypeScope(com.fasterxml.classmate.ResolvedType type, TypeContext context) Constructor. -
Method Summary
Modifier and TypeMethodDescriptioncom.fasterxml.classmate.ResolvedTypeIdentify the element/item type of the givenSchemaKeyword.TAG_TYPE_ARRAY.Getter for the overall type resolution context.Constructing a string that represents this member's type (including possible type parameters and their actual types) - including package names.Constructing a string that represents this member's type (including possible type parameters and their actual types) - excluding package names.com.fasterxml.classmate.ResolvedTypegetType()Returns represented type; if there is one, for methods this is the return type and for fields their field type.com.fasterxml.classmate.ResolvedTypegetTypeParameterFor(Class<?> erasedSuperType, int parameterIndex) Find type parameterization for the specified (super) type at return the type parameter at the given index.booleanDetermine whether this targeted type should be treated asSchemaKeyword.TAG_TYPE_ARRAYin the generated schema.toString()
-
Constructor Details
-
TypeScope
Constructor.- Parameters:
type- targeted typecontext- the overall type resolution context
-
-
Method Details
-
getContext
Getter for the overall type resolution context.- Returns:
- type resolution context
-
getType
public com.fasterxml.classmate.ResolvedType getType()Returns represented type; if there is one, for methods this is the return type and for fields their field type.- Returns:
- represented type
-
getTypeParameterFor
public com.fasterxml.classmate.ResolvedType getTypeParameterFor(Class<?> erasedSuperType, int parameterIndex) Find type parameterization for the specified (super) type at return the type parameter at the given index.- Parameters:
erasedSuperType- (super) type to find declared type parameter forparameterIndex- index of the single type parameter's declared type to return- Returns:
- declared parameter type; or Object.class if no parameters are defined; or null if the given type or index are invalid
- See Also:
-
isContainerType
public boolean isContainerType()Determine whether this targeted type should be treated asSchemaKeyword.TAG_TYPE_ARRAYin the generated schema.
This is equivalent to calling:scope.getContext().isContainerType(scope.getType())- Returns:
- whether the targeted type is an array or sub type of
Collection
-
getContainerItemType
public com.fasterxml.classmate.ResolvedType getContainerItemType()Identify the element/item type of the givenSchemaKeyword.TAG_TYPE_ARRAY.
This is equivalent to calling:scope.getContext().getContainerItemType(scope.getType())- Returns:
- type of elements/items
-
getSimpleTypeDescription
Constructing a string that represents this member's type (including possible type parameters and their actual types) - excluding package names.
This is equivalent to calling:scope.getContext().getSimpleTypeDescription(scope.getType())- Returns:
- resulting string
- See Also:
-
getFullTypeDescription
Constructing a string that represents this member's type (including possible type parameters and their actual types) - including package names.
This is equivalent to calling:scope.getContext().getFullTypeDescription(scope.getType())- Returns:
- resulting string
- See Also:
-
toString
-