Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added URLGit for handling Github URLs which will now use the version of the API running to avoid inconsistencies.
- Loading branch information
1 parent
9fae7ef
commit c58277b
Showing
2 changed files
with
40 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
core/src/main/java/com/github/fernthedev/fernapi/universal/api/URLGit.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.github.fernthedev.fernapi.universal.api; | ||
|
||
import lombok.Getter; | ||
|
||
/** | ||
* Holds URLs for github files that may change in the future. | ||
*/ | ||
@Getter | ||
public class URLGit { | ||
|
||
private static final String tag; | ||
|
||
static { | ||
Package pack = URLGit.class.getPackage(); | ||
String checkTag = pack.getSpecificationVersion(); | ||
|
||
if (checkTag == null) checkTag = pack.getImplementationVersion(); | ||
if (checkTag == null) throw new NullPointerException("Version is somehow null. Checked specification and implementation"); | ||
|
||
tag = checkTag; | ||
} | ||
|
||
public static String formatString(String string) { | ||
return string | ||
.replaceAll("%tag%", tag); | ||
} | ||
|
||
public static final String MAIN_PATH = "https://github.com/Fernthedev/FernAPI/"; | ||
public static final String FILE_PATH = MAIN_PATH + "blob/%tag%/"; | ||
public static final String DOCS = FILE_PATH + "docs/"; | ||
|
||
public static final String INCORRECT_SETUP = formatString(DOCS + "error/incorrectsetup.md"); | ||
|
||
|
||
} |