org.apache.abdera.i18n.templates
Class Template

java.lang.Object
  extended by org.apache.abdera.i18n.templates.Template
All Implemented Interfaces:
Serializable, Cloneable, Iterable<String>

public final class Template
extends Object
implements Iterable<String>, Cloneable, Serializable

Used to evaluate a URI Template. Instances are immutable, cloneable, serializable and threadsafe.

See Also:
Serialized Form

Constructor Summary
Template(String pattern)
           
 
Method Summary
 Template clone()
          Clone this Template instance
 boolean equals(Object obj)
           
 String expand(Context context)
          Expand the URI Template using the specified Context.
 String expand(Object object)
          Expand the URI Template using the non-private fields and methods of the specified object to resolve the template tokens
 String expand(Object object, boolean isiri)
          Expand the template using the non-private fields and methods of the specified object to resolve the template tokens.
static String expand(String pattern, Context context)
           
static String expand(String pattern, Object object)
           
static String expand(String pattern, Object object, boolean isiri)
           
static String expandAnnotated(Object object)
          Use an Object annotated with the URITemplate annotation to expand a template
 String explain()
           
 void explain(Appendable buf)
           
static String explain(String pattern)
           
static void explain(String pattern, Appendable buf)
           
 String getPattern()
          Return the URI Template pattern
 String getPatternForDisplay()
          IRI Templates that contain bidirectional characters will typically not display properly in unicode enabled environments.
 String[] getVariables()
          Return the array of template variables
 int hashCode()
           
 Iterator<String> iterator()
          Iterate the template tokens
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Template

public Template(String pattern)
Parameters:
pattern - A URI Template
Method Detail

getPattern

public String getPattern()
Return the URI Template pattern


getPatternForDisplay

public String getPatternForDisplay()
IRI Templates that contain bidirectional characters will typically not display properly in unicode enabled environments. This method return the Template with appropriate bidi control characters to ensure that the Template can be rendered properly for display


iterator

public Iterator<String> iterator()
Iterate the template tokens

Specified by:
iterator in interface Iterable<String>

getVariables

public String[] getVariables()
Return the array of template variables


expand

public String expand(Context context)
Expand the URI Template using the specified Context.

Parameters:
context - The Context impl used to resolve variable values
Returns:
An expanded URI

expand

public String expand(Object object)
Expand the URI Template using the non-private fields and methods of the specified object to resolve the template tokens


expand

public String expand(Object object,
                     boolean isiri)
Expand the template using the non-private fields and methods of the specified object to resolve the template tokens. If isiri is true, IRI escaping rules will be used.


clone

public Template clone()
Clone this Template instance

Overrides:
clone in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

explain

public String explain()

explain

public void explain(Appendable buf)
             throws IOException
Throws:
IOException

expand

public static String expand(String pattern,
                            Context context)

expand

public static String expand(String pattern,
                            Object object)

expand

public static String expand(String pattern,
                            Object object,
                            boolean isiri)

expandAnnotated

public static String expandAnnotated(Object object)
Use an Object annotated with the URITemplate annotation to expand a template


explain

public static String explain(String pattern)

explain

public static void explain(String pattern,
                           Appendable buf)
                    throws IOException
Throws:
IOException


Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.