org.eel.kitchen.jsonschema.uri
Class URIHandlerFactory

java.lang.Object
  extended by org.eel.kitchen.jsonschema.uri.URIHandlerFactory

public final class URIHandlerFactory
extends Object

Factory providing URIHandler instances

This looks at the scheme of the URI to determine what handler is returned. You can register handlers for any scheme of you choice, but if you do so, remember about interoperability!


Constructor Summary
URIHandlerFactory()
          Constructor.
 
Method Summary
 URIHandler getHandler(URI uri)
          Get a handler for the given URI
 void registerHandler(String scheme, URIHandler handler)
          Register a handler for a new scheme
 void unregisterHandler(String scheme)
          Unregister a handler for a given scheme
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URIHandlerFactory

public URIHandlerFactory()
Constructor. Right now the only thing it does it registering a HTTPURIHandler, certainly the mostly used one -- which is why it is already provided

Method Detail

registerHandler

public void registerHandler(String scheme,
                            URIHandler handler)
Register a handler for a new scheme

Parameters:
scheme - the scheme
handler - the handler
Throws:
IllegalArgumentException - the scheme is invalid, a handler is already registered for that scheme, or the handler is null

unregisterHandler

public void unregisterHandler(String scheme)
Unregister a handler for a given scheme

Parameters:
scheme - the victim

getHandler

public URIHandler getHandler(URI uri)
Get a handler for the given URI

The URI must be absolute here.

Parameters:
uri - the URI
Returns:
the handler
Throws:
IllegalArgumentException - the URI is not absolute, or the scheme of this URI is not registered


Copyright © 2012. All Rights Reserved.