Class BaseCollector

java.lang.Object
io.github.torand.openapi2java.collectors.BaseCollector
Direct Known Subclasses:
EnumInfoCollector, MethodInfoCollector, OpenApiDefInfoCollector, PojoInfoCollector, PropertyInfoCollector, ResourceInfoCollector, SecurityRequirementCollector, TypeInfoCollector

public abstract class BaseCollector extends Object
Base class for all collectors.
  • Field Details

    • opts

      protected final Options opts
      The plugin options.
  • Constructor Details

    • BaseCollector

      protected BaseCollector(Options opts)
      Constructs a BaseCollector object.
      Parameters:
      opts - the plugin options.
  • Method Details

    • normalizeDescription

      protected String normalizeDescription(String description)
      Modifies the description text for further use in code generation.
      Parameters:
      description - the original description text.
      Returns:
      the normalized description.
    • normalizePath

      protected String normalizePath(String path)
      Modifies the path string for further use in code generation.
      Parameters:
      path - the original path string.
      Returns:
      the normalized path.
    • dirPath2PackagePath

      protected String dirPath2PackagePath(String dirPath)
      Converts a directory path into a package path.
      Parameters:
      dirPath - the directory path.
      Returns:
      the package path.
    • modelName2SchemaName

      protected String modelName2SchemaName(String modelName)
      Converts a model (pojo) name into a schema name.
      Parameters:
      modelName - the model name.
      Returns:
      the schema name.
    • formatClassRef

      protected String formatClassRef(String className)
      Formats given class name to language specific class reference.
      Parameters:
      className - the class name.
      Returns:
      the class reference.
    • formatInnerAnnotation

      protected String formatInnerAnnotation(String annotation, Object... args)
      Formats an annotation for use as parameter value for an outer annotation.
      Parameters:
      annotation - the inner annotation.
      args - annotation string arguments.
      Returns:
      the formatted annotation.
    • formatAnnotationDefaultParam

      protected String formatAnnotationDefaultParam(List<String> value)
      Formats a default parameter value for an annotation.
      Parameters:
      value - the parameter value
      Returns:
      the formatted parameter.
    • formatAnnotationNamedParam

      protected String formatAnnotationNamedParam(List<String> value)
      Formats a named parameter for an annotation.
      Parameters:
      value - the parameter value.
      Returns:
      the formatted parameter.
    • formatDeprecationMessage

      protected String formatDeprecationMessage(Map<String,Object> extensionsByName)
      Formats a deprecation message.
      Parameters:
      extensionsByName - the OpenAPI extensions containing a custom deprecation message, or not.
      Returns:
      the formatted deprecation message.
    • getHeaderNameConstant

      protected ConstantValue getHeaderNameConstant(String name)
      Gets header name constant from specified header name.
      Parameters:
      name - the header name.
      Returns:
      the header name constant.