01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: UrlResource.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.engine;
09:
10: import java.net.URL;
11:
12: /**
13: * Packages an <code>URL</code> resource together with additional data that
14: * can't be stored in the <code>URL</code> instance itself.
15: *
16: * @author Geert Bevin (gbevin[remove] at uwyn dot com)
17: * @version $Revision: 3634 $
18: * @since 1.5
19: */
20: public class UrlResource {
21: private URL mUrl = null;
22: private String mSourceName = null;
23:
24: /**
25: * Creates a new <code>UrlResource</code> instance.
26: *
27: * @param url the URL of the resource
28: * @param sourceName the source name that was used to look up the resource
29: * @since 1.5
30: */
31: public UrlResource(URL url, String sourceName) {
32: assert url != null;
33:
34: mUrl = url;
35: mSourceName = sourceName;
36: }
37:
38: /**
39: * Retrieves the URL of the resource.
40: *
41: * @return the URL of the resource
42: * @since 1.5
43: */
44: public URL getUrl() {
45: return mUrl;
46: }
47:
48: /**
49: * Retrieves the source name that was used to look up the resource.
50: *
51: * @return the source name that was used to look up the resource
52: * @since 1.5
53: */
54: public String getSourceName() {
55: return mSourceName;
56: }
57:
58: public boolean equals(Object other) {
59: if (other instanceof UrlResource) {
60: return mUrl.equals(((UrlResource) other).getUrl());
61: }
62:
63: return false;
64: }
65:
66: public int hashCode() {
67: return mUrl.hashCode();
68: }
69: }
|