Last active
January 3, 2016 14:39
-
-
Save marcomorain/8477297 to your computer and use it in GitHub Desktop.
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
package com.swrve.babble; | |
import java.net.MalformedURLException; | |
import java.net.URI; | |
import java.net.URISyntaxException; | |
import java.net.URL; | |
import org.glassfish.jersey.uri.UriTemplate; | |
public class UrlTemplate { | |
public class InvalidException extends Exception { | |
public InvalidException(String message) { | |
super(message); | |
} | |
public InvalidException(String message, Throwable cause) { | |
super(message, cause); | |
} | |
public InvalidException(Throwable cause) { | |
super(cause); | |
} | |
} | |
private final String template; | |
public UrlTemplate(String template) { | |
this.template = template; | |
} | |
@Override | |
public String toString(){ | |
return template; | |
} | |
public boolean isComplete() { | |
return template.indexOf('{') == -1; | |
} | |
public URL toUrl() throws MalformedURLException { | |
return new URL(template); | |
} | |
public URI toUri() throws URISyntaxException { | |
return new URI(template); | |
} | |
public UriTemplate | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment