View Javadoc

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    private boolean isNull = true;
11  
12    public SearchType(Type type) {
13      this.type = type;
14      this.name = null;
15      isNull = false;
16    }
17  
18    public SearchType(String name) {
19      this.name = name;
20      this.type = null;
21      isNull = false;
22    }
23  
24    public SearchType() {
25      this.name = null;
26      this.type = null;
27    }
28  
29    public String toString() {
30      if (isNull) return "";
31      return (type == null) ? name : type.getType();
32    }
33  
34    public boolean isNull() {
35      return isNull;
36    }
37  
38    
39    public String pathise() {
40      if (type == null)
41        return "/_";
42      return "/" + UTF8URLEncoder.encode(type.getType());
43    }
44    
45    
46  }