org.apache.abdera.i18n.templates
Class Route

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

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

A type of URI Template loosely based on Ruby on Rails style Routes. Example: Route feed_route = new Route("feed",":feed/:entry");

See Also:
Serialized Form

Constructor Summary
Route(String name, String pattern)
           
Route(String name, String pattern, Map<String,String> defaultValues, Map<String,String> requirements)
           
 
Method Summary
 Route clone()
           
 boolean equals(Object obj)
           
 String expand(Context context)
          Expand the route pattern given the specified context
 String expand(Object object)
          Expand the route pattern given the specified context object
 String expand(Object object, boolean isiri)
          Expand the route pattern using IRI escaping rules
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)
           
 String getDefaultValue(String var)
           
 Map<String,String> getDefaultValues()
           
 String getName()
           
 String getPattern()
           
 String getRequirement(String var)
           
 Map<String,String> getRequirements()
           
 String[] getVariables()
           
 int hashCode()
           
 Iterator<String> iterator()
           
 boolean match(String uri)
          Returns true if the given uri matches the route pattern
 Map<String,String> parse(String uri)
          Parses the given uri using the route pattern
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Route

public Route(String name,
             String pattern)

Route

public Route(String name,
             String pattern,
             Map<String,String> defaultValues,
             Map<String,String> requirements)
Method Detail

match

public boolean match(String uri)
Returns true if the given uri matches the route pattern


parse

public Map<String,String> parse(String uri)
Parses the given uri using the route pattern


expand

public String expand(Context context)
Expand the route pattern given the specified context


getDefaultValue

public String getDefaultValue(String var)

getRequirement

public String getRequirement(String var)

expand

public String expand(Object object)
Expand the route pattern given the specified context object


expand

public String expand(Object object,
                     boolean isiri)
Expand the route pattern using IRI escaping rules


getName

public String getName()

getPattern

public String getPattern()

iterator

public Iterator<String> iterator()
Specified by:
iterator in interface Iterable<String>

getVariables

public String[] getVariables()

getDefaultValues

public Map<String,String> getDefaultValues()

getRequirements

public Map<String,String> getRequirements()

clone

public Route clone()
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

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)


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