Class TypeScope

  • Direct Known Subclasses:
    MemberScope

    public class TypeScope
    extends Object
    Representation of a single type to represent as (sub) schema.
    • Constructor Detail

      • TypeScope

        protected TypeScope​(com.fasterxml.classmate.ResolvedType type,
                            TypeContext context)
        Constructor.
        Parameters:
        type - targeted type
        context - the overall type resolution context
    • Method Detail

      • getContext

        public TypeContext 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 for
        parameterIndex - 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:
        TypeContext.getTypeParameterFor(ResolvedType, Class, int)
      • isContainerType

        public boolean isContainerType()
        Determine whether this targeted type should be treated as SchemaKeyword.TAG_TYPE_ARRAY in 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 given SchemaKeyword.TAG_TYPE_ARRAY.
        This is equivalent to calling: scope.getContext().getContainerItemType(scope.getType())
        Returns:
        type of elements/items
      • getSimpleTypeDescription

        public String 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:
        getType(), TypeContext.getSimpleTypeDescription(ResolvedType)
      • getFullTypeDescription

        public String 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:
        getType(), TypeContext.getFullTypeDescription(ResolvedType)