Package org.apache.abdera.i18n.templates

Examples of org.apache.abdera.i18n.templates.Template


      setTemplate(entry.getKey(),entry.getValue());
    }
  }
 
  public TemplateTargetBuilder setTemplate(Object key, String template) {
    return setTemplate(key, new Template(template));
  }
View Full Code Here


  public TemplateTargetBuilder setTemplate(Object key, String template) {
    return setTemplate(key, new Template(template));
  }
 
  public TemplateTargetBuilder setTemplate(Object key, Template template) {
    template = new Template(doReplacements(template.getPattern()));
    templates.put(key,template);
    return this;
  }
View Full Code Here

 
  public String urlFor(
    RequestContext request,
    Object key,
    Object param) {
      Template template = templates.get(key);
      return template != null ? template.expand(getContext(request,param)) : null;
  }
View Full Code Here

  }
 
  @Test
  public void test18() throws Exception {
    String t = "http://www.google.com/notebook/feeds/{userID}{-prefix|/notebooks/|notebookID}{-opt|/-/|categories}{-list|/|categories}?{-join|&|updated-min,updated-max,alt,start-index,max-results,entryID,orderby}";
    Template template = new Template(t);
    String[] variables = template.getVariables();
    assertEquals(variables[0],"userID");
    assertEquals(variables[1],"notebookID");
    assertEquals(variables[2],"categories");
    assertEquals(variables[3],"updated-min");
    assertEquals(variables[4],"updated-max");
View Full Code Here

  }

  @Test
  public void test19() throws Exception {
    String t = "http://www.google.com/notebook/feeds/{userID}{-prefix|/notebooks/|notebookID}{-opt|/-/|categories}{-list|/|categories}?{-join|&|updated-min,updated-max,alt,start-index,max-results,entryID,orderby}";
    Template template = new Template(t);
    Template t2 = template.clone();
    assertEquals(template,t2);
    assertEquals(template.hashCode(),t2.hashCode());
  }
View Full Code Here

    @Test
    public void test18() throws Exception {
        String t =
            "http://www.google.com/notebook/feeds/{userID}{-prefix|/notebooks/|notebookID}{-opt|/-/|categories}{-list|/|categories}?{-join|&|updated-min,updated-max,alt,start-index,max-results,entryID,orderby}";
        Template template = new Template(t);
        String[] variables = template.getVariables();
        assertEquals("userID", variables[0]);
        assertEquals("notebookID", variables[1]);
        assertEquals("categories", variables[2]);
        assertEquals("updated-min", variables[3]);
        assertEquals("updated-max", variables[4]);
View Full Code Here

    @Test
    public void test19() throws Exception {
        String t =
            "http://www.google.com/notebook/feeds/{userID}{-prefix|/notebooks/|notebookID}{-opt|/-/|categories}{-list|/|categories}?{-join|&|updated-min,updated-max,alt,start-index,max-results,entryID,orderby}";
        Template template = new Template(t);
        Template t2 = template.clone();
        assertEquals(t2, template);
        assertEquals(t2.hashCode(), template.hashCode());
    }
View Full Code Here

public class TestTemplate {
 
    @Test
    public void testTemplateNeg() {
        Template t = new Template("*http://cnn.com/{-neg|all|foo,bar}");
        Map m = new HashMap();
        m.put("foo", "value");
        String out = t.expand(m);

        assertEquals("*http://cnn.com/", out);
    }
View Full Code Here

            setTemplate(entry.getKey(), entry.getValue());
        }
    }

    public TemplateTargetBuilder setTemplate(Object key, String template) {
        return setTemplate(key, new Template(template));
    }
View Full Code Here

    public TemplateTargetBuilder setTemplate(Object key, String template) {
        return setTemplate(key, new Template(template));
    }

    public TemplateTargetBuilder setTemplate(Object key, Template template) {
        template = new Template(doReplacements(template.getPattern()));
        templates.put(key, template);
        return this;
    }
View Full Code Here

TOP

Related Classes of org.apache.abdera.i18n.templates.Template

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.