Coverage Report - com.damnhandy.uri.template.Literal
 
Classes in this File Line Coverage Branch Coverage Complexity
Literal
71%
5/7
N/A
1
 
 1  
 /*
 2  
  *
 3  
  *
 4  
  */
 5  
 package com.damnhandy.uri.template;
 6  
 
 7  
 import java.util.regex.Pattern;
 8  
 
 9  
 /**
 10  
  * Represents the non-expression parts of a URI Template
 11  
  * 
 12  
  * @author <a href="ryan@damnhandy.com">Ryan J. McDonough</a>
 13  
  * @version $Revision: 1.1 $
 14  
  * @since 2.0
 15  
  */
 16  
 public class Literal extends UriTemplateComponent
 17  
 {
 18  
 
 19  
    /** The serialVersionUID */
 20  
    private static final long serialVersionUID = 6011009312823496878L;
 21  
 
 22  
    private final String value;
 23  
 
 24  
    private final Pattern matchPattern;
 25  
 
 26  
    /**
 27  
     * Create a new Literal.
 28  
     * 
 29  
     */
 30  
    public Literal(final String value, int startPosition)
 31  
    {
 32  444
       super(startPosition);
 33  444
       this.value = value;
 34  444
       this.matchPattern = Pattern.compile(Pattern.quote(getValue()));
 35  444
    }
 36  
 
 37  
    @Override
 38  
    public String getValue()
 39  
    {
 40  588
       return value;
 41  
    }
 42  
 
 43  
    @Override
 44  
    public String toString()
 45  
    {
 46  0
       return value;
 47  
    }
 48  
 
 49  
    @Override
 50  
    public Pattern getMatchPattern()
 51  
    {
 52  0
       return this.matchPattern;
 53  
    }
 54  
 
 55  
 }