KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > wings > SimpleURL


1 /*
2  * $Id: SimpleURL.java,v 1.3 2004/12/01 07:54:07 hengels Exp $
3  * Copyright 2000,2005 wingS development team.
4  *
5  * This file is part of wingS (http://www.j-wings.org).
6  *
7  * wingS is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License
9  * as published by the Free Software Foundation; either version 2.1
10  * of the License, or (at your option) any later version.
11  *
12  * Please see COPYING for the complete licence.
13  */

14 package org.wings;
15
16 import org.wings.io.Device;
17
18 import java.io.IOException JavaDoc;
19 import java.io.Serializable JavaDoc;
20
21 /**
22  * A simple URL.
23  *
24  * @version $Revision: 1.3 $
25  */

26 public class SimpleURL implements Serializable JavaDoc, Renderable {
27     protected String JavaDoc baseURL;
28
29     protected SimpleURL() {}
30
31     public SimpleURL(String JavaDoc url) {
32         baseURL = url;
33     }
34
35     public void write(Device d) throws IOException JavaDoc {
36         if (baseURL != null) {
37             d.print(baseURL);
38         }
39     }
40
41     public boolean equals(Object JavaDoc o) {
42         if (o == null) return false;
43         SimpleURL other = (SimpleURL) o;
44         return (baseURL == other.baseURL
45                 || (baseURL != null && baseURL.equals(other.baseURL)));
46     }
47
48     /**
49      * @see java.lang.Object#hashCode()
50      */

51     public int hashCode() {
52         return baseURL != null ? baseURL.hashCode() : 0;
53     }
54
55     public String JavaDoc toString() {
56         return baseURL;
57     }
58 }
59
60
61
Popular Tags