01: /*
02: * Copyright 2000,2005 wingS development team.
03: *
04: * This file is part of wingS (http://wingsframework.org).
05: *
06: * wingS is free software; you can redistribute it and/or modify
07: * it under the terms of the GNU Lesser General Public License
08: * as published by the Free Software Foundation; either version 2.1
09: * of the License, or (at your option) any later version.
10: *
11: * Please see COPYING for the complete licence.
12: */
13: package org.wings;
14:
15: import org.wings.io.Device;
16:
17: import java.io.IOException;
18: import java.io.Serializable;
19:
20: /**
21: * Simple URL representation.
22: *
23: */
24: public class SimpleURL implements Serializable, Renderable {
25: protected String baseURL;
26:
27: protected SimpleURL() {
28: }
29:
30: public SimpleURL(String url) {
31: if (url == null)
32: throw new IllegalArgumentException("null not allowed");
33: baseURL = url;
34: }
35:
36: public void write(Device d) throws IOException {
37: if (baseURL != null) {
38: d.print(baseURL);
39: }
40: }
41:
42: public boolean equals(Object o) {
43: if (o == null)
44: return false;
45: SimpleURL other = (SimpleURL) o;
46: return (baseURL == other.baseURL || (baseURL != null && baseURL
47: .equals(other.baseURL)));
48: }
49:
50: /**
51: * @see java.lang.Object#hashCode()
52: */
53: public int hashCode() {
54: return baseURL != null ? baseURL.hashCode() : 0;
55: }
56:
57: public String toString() {
58: return baseURL;
59: }
60: }
|