aboutsummaryrefslogtreecommitdiff
path: root/src/support/lombok/website/Domain.java
blob: 103c737748013fe0130990510b9b25fd7c46929b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package lombok.website;

import java.net.MalformedURLException;
import java.net.URL;

public class Domain {
	private static final String DEFAULT = "https://projectlombok.org/";
	private final String prefix;
	
	public Domain(String arg) {
		if (arg == null || arg.isEmpty()) this.prefix = DEFAULT;
		else {
			if (!arg.contains("://")) arg = "https://" + arg;
			if (!arg.endsWith("/")) arg += "/";
			this.prefix = arg;
		}
	}
	
	public String getPrefix() {
		return prefix;
	}
	
	public URL url(String path) throws MalformedURLException {
		return new URL(prefix + path);
	}
}