Class ConflictRenamer

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

public final class ConflictRenamer extends Object
Renames types to avoid on-disk conflicts. It changes the name of DTOs and adds renaming mapping to the TypeNames so the generators will get the new names. The MP @Schema name is also changed, using its own namespace. This is needed to avoid @Schema declaring a different name than that assigned to the DTO. May need a separate switch.
  • Constructor Details

    • ConflictRenamer

      public ConflictRenamer(TypeNames typeNames, Naming naming, List<String> schemaNamesDeclarationOrder)
      Constructs a new instance.
      Parameters:
      typeNames - the type names instance
      naming - the naming instance
      schemaNamesDeclarationOrder - the OpenApi schema declaration order
  • Method Details

    • resolveNameConflicts

      public Collection<Dto> resolveNameConflicts(Collection<Dto> dtos)
      Resolves name conflicts in DTOs. Returns new DTO instances that have been renamed. References in their properties have *not* been resolved.
      Parameters:
      dtos - the DTOs to rename
      Returns:
      the renamed DTOs
    • getConflictRenamedDto

      public Type getConflictRenamedDto(Dto dto)
      Maps pre-renamed DTO instance to new (possibly renamed) instance.
      Parameters:
      dto - pre-renamed DTO
      Returns:
      same DTO instance, but renamed if required