1 /**
2 * Licensed under the Artistic License; you may not use this file
3 * except in compliance with the License.
4 * You may obtain a copy of the License at
5 *
6 * http://displaytag.sourceforge.net/license.html
7 *
8 * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
9 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
10 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11 */
12 package org.displaytag.util;
13
14 import java.io.Serializable;
15 import java.util.Map;
16
17
18 /**
19 * Interface representing an URI (the href parameter of an <a> tag). Provides methods to insert new parameters. It
20 * doesn't support multiple parameter values
21 * @author Fabrizio Giustina
22 * @version $Revision: 1081 $ ($Author: fgiust $)
23 */
24 public interface Href extends Cloneable, Serializable
25 {
26
27 /**
28 * Adds a parameter to the href.
29 * @param name String
30 * @param value Object
31 * @return this Href instance, useful for concatenation.
32 */
33 Href addParameter(String name, Object value);
34
35 /**
36 * Removes a parameter from the href.
37 * @param name String
38 */
39 void removeParameter(String name);
40
41 /**
42 * Adds an int parameter to the href.
43 * @param name String
44 * @param value int
45 * @return this Href instance, useful for concatenation.
46 */
47 Href addParameter(String name, int value);
48
49 /**
50 * Getter for the map containing link parameters. The returned map is always a copy and not the original instance.
51 * @return parameter Map (copy)
52 */
53 Map getParameterMap();
54
55 /**
56 * Adds all the parameters contained in the map to the Href. The value in the given Map will be escaped before
57 * added. Any parameter already present in the href object is removed.
58 * @param parametersMap Map containing parameters
59 */
60 void setParameterMap(Map parametersMap);
61
62 /**
63 * Adds all the parameters contained in the map to the Href. The value in the given Map will be escaped before
64 * added. Parameters in the original href are kept and not overridden.
65 * @param parametersMap Map containing parameters
66 */
67 void addParameterMap(Map parametersMap);
68
69 /**
70 * Getter for the base url (without parameters).
71 * @return String
72 */
73 String getBaseUrl();
74
75 /**
76 * Set the full url, overriding any existing parameter.
77 * @param url full url
78 */
79 void setFullUrl(String url);
80
81 /**
82 * Returns the URI anchor.
83 * @return anchor or <code>null</code> if no anchor has been set.
84 */
85 String getAnchor();
86
87 /**
88 * Setter for the URI anchor.
89 * @param name string to be used as anchor name (without #).
90 */
91 void setAnchor(String name);
92
93 /**
94 * toString: output the full url with parameters.
95 * @return String
96 */
97 String toString();
98
99 /**
100 * @see java.lang.Object#clone()
101 */
102 Object clone();
103
104 /**
105 * @see java.lang.Object#equals(Object)
106 */
107 boolean equals(Object object);
108
109 }