1 | |
package org.paneris.jammyjoes.controller; |
2 | |
|
3 | |
import org.melati.util.UTF8URLEncoder; |
4 | |
import org.paneris.jammyjoes.model.Type; |
5 | |
|
6 | |
public class SearchType { |
7 | |
|
8 | |
private Type type; |
9 | |
private String name; |
10 | 0 | private boolean isNull = true; |
11 | |
|
12 | 0 | public SearchType(Type type) { |
13 | 0 | this.type = type; |
14 | 0 | this.name = null; |
15 | 0 | isNull = false; |
16 | 0 | } |
17 | |
|
18 | 0 | public SearchType(String name) { |
19 | 0 | this.name = name; |
20 | 0 | this.type = null; |
21 | 0 | isNull = false; |
22 | 0 | } |
23 | |
|
24 | 0 | public SearchType() { |
25 | 0 | this.name = null; |
26 | 0 | this.type = null; |
27 | 0 | } |
28 | |
|
29 | |
public String toString() { |
30 | 0 | if (isNull) return ""; |
31 | 0 | return (type == null) ? name : type.getType(); |
32 | |
} |
33 | |
|
34 | |
public boolean isNull() { |
35 | 0 | return isNull; |
36 | |
} |
37 | |
|
38 | |
|
39 | |
public String pathise() { |
40 | 0 | if (type == null) |
41 | 0 | return "/_"; |
42 | 0 | return "/" + UTF8URLEncoder.encode(type.getType()); |
43 | |
} |
44 | |
|
45 | |
|
46 | |
} |