Class ParserTypes

java.lang.Object
dk.mada.jaxrs.openapi.ParserTypes

public class ParserTypes extends Object
Types found while parsing. This is only used to collect the types. When parsing is completed, they will be moved to the model's Types container after being resolved and mapped.
  • Constructor Details

    • ParserTypes

      public ParserTypes(TypeNames typeNames, ParserOpts parserOpts, Parser.LeakedGeneratorOpts leakedGenOpts)
      Create new instance.
      Parameters:
      typeNames - the type names instance
      parserOpts - the parser options
      leakedGenOpts - the leaked generator options
  • Method Details

    • getOrMakeInterface

      public TypeInterface getOrMakeInterface(TypeName tn, List<ParserTypeRef> anyOfRefs)
      Get or make a new interface type.
      Parameters:
      tn - the type name of the interface
      anyOfRefs - the types referenced by the interface
      Returns:
      an existing or new interface type
    • getInterfaces

      public Set<TypeInterface> getInterfaces()
      Returns all the interfaces.
      Returns:
      all the interfaces
    • getInterfacesImplementedBy

      public List<TypeInterface> getInterfacesImplementedBy(TypeName tn)
      Returns the interfaces implemented by a given type name.
      Parameters:
      tn - the type name to look for.
      Returns:
      the interfaces implemented by a given type name
    • addDto

      public void addDto(Dto dto)
      Registers a new DTO.
      Parameters:
      dto - the DTO to register.
    • getActiveDtos

      public Set<Dto> getActiveDtos()
      Returns the defined DTOs.
      Returns:
      the defined DTOs
    • get

      public Type get(TypeName tn)
      Get a type from a type name.
      Parameters:
      tn - the type name to get
      Returns:
      the associated type
      Throws:
      IllegalArgumentException - if there is no type associated with the given type name
    • find

      public Optional<Type> find(TypeName tn)
      Find a type from a type name.
      Parameters:
      tn - the type name to get
      Returns:
      the associated type, or empty
    • consolidateContainerDtos

      public void consolidateContainerDtos()
      Collection types such as ListDto are changed to List<Dto>.
    • remapDto

      public Type remapDto(TypeName openapiName, Type newType)
      Remaps a DTO to a new type. The target type gets stripped from empty validation references.
      Parameters:
      openapiName - the DTOs OpenApi name
      newType - the type to remap the DTO to
      Returns:
      the actual type remapped to (may have fewer validation references)
    • info

      public String info()
      Returns information about the model.
      Returns:
      information about the model