Class GitLabRepoUrl

java.lang.Object
studentrepoloader.model.GitLabRepoUrl

public final class GitLabRepoUrl extends Object
Value object representing a cleaned and validated GitLab repository URL, with full traceability of all applied sanitation steps.

This object is used by default in the GitLabSubmissionFields interface to normalize raw student input into a usable HTTPS clone URL.

It provides immutable access to:

  • The final cleaned URL (typically HTTPS + .git suffix)
  • A list of GitLabRepoUrl.CleaningStep values that describe each transformation
All transformations are stateless and correspond directly to a defined CleaningStep. Each transformation method is exposed for unit testing.

Typical usage:


 for (DefaultGitLabSubmission s : submissions) {
     GitLabRepoUrl repo = s.getRepoUrl();
     System.out.println("Clean URL: " + repo.url());
     System.out.println("Steps:     " + repo.steps());
 }
 
  • Method Details

    • parse

      public static GitLabRepoUrl parse(String raw, String expectedPrefix)
      Parses and sanitizes a raw input string using the expected GitLab prefix.

      Applies multiple cleaning operations in sequence, tracking each applied transformation via GitLabRepoUrl.CleaningStep.

      Parameters:
      raw - raw input string from CSV
      expectedPrefix - required host prefix (e.g. "https://gitlab.utu.fi/")
      Returns:
      a fully cleaned GitLabRepoUrl with transformation log
    • url

      public String url()
      Returns the sanitized URL string, typically HTTPS and ending with .git.
    • steps

      Returns an immutable list of cleaning operations that were applied. This can be used for auditing, diagnostics, or rule-based filtering.
    • toString

      public String toString()
      Overrides:
      toString in class Object