1 package com.atlassian.asap.core.keys;
2
3 import javax.annotation.Nullable;
4 import java.net.URI;
5 import java.net.URISyntaxException;
6
7 /**
8 * A class to create <strong>informative</strong> classpath URI.
9 */
10 public final class ClassPathUri {
11 /**
12 * Creates a URI that denotes a classpath resource, using the <em>classpath</em> pseudo protocol.
13 *
14 * @param path the path to the resource in the classpath
15 * @return a URI that denotes a classpath resource or {@code null} if there was a syntax exception
16 */
17 @Nullable
18 public static URI classPathUri(String path) {
19 try {
20 return new URI("classpath:" + path);
21 } catch (URISyntaxException e) {
22 return null;
23 }
24 }
25 }