Class Template

  • Direct Known Subclasses:
    BodyTemplate, HeaderTemplate, QueryTemplate, UriTemplate

    public abstract class Template
    extends java.lang.Object
    A Generic representation of a Template Expression as defined by RFC 6570, with some relaxed rules, allowing the concept to be used in areas outside of the uri.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean allowUnresolved()  
      boolean encode()  
      boolean encodeSlash()  
      java.lang.String expand​(java.util.Map<java.lang.String,​?> variables)
      Expand the template.
      java.nio.charset.Charset getCharset()
      The Charset for the template.
      java.util.List<java.lang.String> getLiterals()
      List of all Literals in the Template.
      java.util.List<java.lang.String> getVariables()
      Variable names contained in the template.
      boolean isLiteral()
      Flag to indicate that this template is a literal string, with no variable expressions.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • expand

        public java.lang.String expand​(java.util.Map<java.lang.String,​?> variables)
        Expand the template.
        Parameters:
        variables - containing the values for expansion.
        Returns:
        a fully qualified URI with the variables expanded.
      • getVariables

        public java.util.List<java.lang.String> getVariables()
        Variable names contained in the template.
        Returns:
        a List of Variable Names.
      • getLiterals

        public java.util.List<java.lang.String> getLiterals()
        List of all Literals in the Template.
        Returns:
        list of Literal values.
      • isLiteral

        public boolean isLiteral()
        Flag to indicate that this template is a literal string, with no variable expressions.
        Returns:
        true if this template is made up entirely of literal strings.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • allowUnresolved

        public boolean allowUnresolved()
      • encode

        public boolean encode()
      • encodeSlash

        public boolean encodeSlash()
      • getCharset

        public java.nio.charset.Charset getCharset()
        The Charset for the template.
        Returns:
        the Charset, if set. Defaults to UTF-8