Skip to content
/ jogu Public

A Java object which holding Git repository URL address

License

Notifications You must be signed in to change notification settings

rk0cc/jogu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Object of Git (Repository) URL - JOGU

Test CodeQL Maven Central Official Javadoc Alternate Javadoc GitHub Sponsors

This Java library allows parsing Git repository URL addresses to an actual object with validation included.

Java provides URL and URI to handle these URL already, why create this package?

Yes, most Git repository URL can be parse URL or URI without issue. However, alternative form of SSH URL not.

Alternative SSH address is reference as "SSH" in public git repository which supposed to be invalid technically since it missed protocol and not a port number after the colon. Thus, inheriting URL or URI is disallowed since they are marked as final class. As a result, create new object which replicate how original URL or URI did with incompatable format supported.

Supported protocol of Git repository URL

Most remote protocol are supported in this library.

Protocol format name Example Supported in this library
HTTPS protocol https://example.com/foo.git
Git protocol git://example.com/foo.git
SSH protocol (Legit) ssh://git@example.com/foo.git
SSH protocol (Alternative) git@example.com:foo.git
File protocol file:///path/to/foo.git

Jogu does not support file protocol since it rarely uses and worthless when making actual request under local directory.

Install

Using Maven 3:

<dependencies>
    <dependency>
        <groupId>xyz.rk0cc.jogu</groupId>
        <artifactId>jogu</artifactId>
        <version>1.1.2</version>
    </dependency>
</dependencies>

Usage

Get GitRepositoryURL without specific implemented type uses:

GitRepositoryURL gurl = GitRepositoryURL.parse("git://example.com/foo.git");

Get GitRepositoryURL with specific implemented type uses:

GitGitRepositoryURL gurl = GitRepositoryURL.parse("git://example.com/foo.git", GitGitRepositoryURL.class);

Setup

  • JDK 17 (or above)
  • Maven

License

WTFPL 2.0