| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
package com.damnhandy.uri.template; |
| 6 | |
|
| 7 | |
import java.util.regex.Pattern; |
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
public class Literal extends UriTemplateComponent |
| 17 | |
{ |
| 18 | |
|
| 19 | |
|
| 20 | |
private static final long serialVersionUID = 6011009312823496878L; |
| 21 | |
|
| 22 | |
private final String value; |
| 23 | |
|
| 24 | |
private final Pattern matchPattern; |
| 25 | |
|
| 26 | |
|
| 27 | |
|
| 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 | |
} |