org.jvnet.ws.wadl.ast
Class ElementResolver

java.lang.Object
  extended by org.jvnet.ws.wadl.ast.ElementResolver

public class ElementResolver
extends Object

Maintains a map of file+ref to element.

Author:
mh124079

Constructor Summary
ElementResolver(MessageListener messageListener)
           
 
Method Summary
 String addReference(URI file, String id, Object o)
          Add a reference to an element if it has an identifier.
 Object get(String ref)
          Get the element for a ref.
<T> T
resolve(URI file, String href, T object)
          Resolve a href and return the element if it is of the expected type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ElementResolver

public ElementResolver(MessageListener messageListener)
Method Detail

get

public Object get(String ref)
Get the element for a ref.

Parameters:
ref - the element reference as returned by addReference(java.net.URI, java.lang.String, java.lang.Object).
Returns:
the corresponding element or null if not found.

resolve

public <T> T resolve(URI file,
                     String href,
                     T object)
          throws InvalidWADLException
Resolve a href and return the element if it is of the expected type.

Parameters:
file - the URI of the file in which the referenced element is located, used to absolutize references.
href - the reference to resolve.
object - the original referring object.
Returns:
the resolved object.
Throws:
InvalidWADLException - when WADL is invalid and cannot be processed.

addReference

public String addReference(URI file,
                           String id,
                           Object o)
Add a reference to an element if it has an identifier.

Parameters:
file - the URI of the file that contains the element.
id - the id of the element, may be null.
o - the element.
Returns:
the unique identifier of the element or null if the element did not contain an identifier.


Copyright © 2014. All Rights Reserved.