1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
package com.damnhandy.uri.template; |
6 | |
|
7 | |
import java.io.Serializable; |
8 | |
import java.util.regex.Pattern; |
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
public abstract class UriTemplateComponent implements Serializable |
17 | |
{ |
18 | |
|
19 | |
|
20 | |
private static final long serialVersionUID = -3653287624355221784L; |
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
private final int startPosition; |
26 | |
|
27 | |
public UriTemplateComponent(final int startPoistion) |
28 | 1608 | { |
29 | 1608 | this.startPosition = startPoistion; |
30 | 1608 | } |
31 | |
|
32 | |
public abstract String getValue(); |
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
public int getStartPosition() |
40 | |
{ |
41 | 0 | return startPosition; |
42 | |
} |
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
|
48 | |
|
49 | |
|
50 | |
public abstract Pattern getMatchPattern(); |
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | |
public int getEndPosition() |
57 | |
{ |
58 | 0 | return startPosition + getValue().length(); |
59 | |
} |
60 | |
} |