01: /*
02: * The contents of this file are subject to the
03: * Mozilla Public License Version 1.1 (the "License");
04: * you may not use this file except in compliance with the License.
05: * You may obtain a copy of the License at http://www.mozilla.org/MPL/
06: *
07: * Software distributed under the License is distributed on an "AS IS"
08: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
09: * See the License for the specific language governing rights and
10: * limitations under the License.
11: *
12: * The Initial Developer of the Original Code is Simulacra Media Ltd.
13: * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
14: *
15: * All Rights Reserved.
16: *
17: * Contributor(s):
18: */
19: package org.openharmonise.rm.resources.metadata.properties.ranges;
20:
21: import java.net.URL;
22:
23: import org.openharmonise.rm.metadata.GeneralPropertyInstance;
24:
25: /**
26: * Class which represents a <code>Property</code> range which is
27: * restricted to <code>URL</code> values.
28: *
29: * @author Michael Bell
30: * @version $Revision: 1.2 $
31: *
32: */
33: public class URIRange extends AbstractRange {
34:
35: /**
36: * URI range tag name
37: */
38: public final static String TAG_URI_RANGE = "URIRange";
39:
40: /**
41: * Constructs a new <code>URIRange</code>
42: */
43: public URIRange() {
44: super (URL.class.getName());
45: }
46:
47: /**
48: * Constructs a <cod>URIRange</code> with restrictions
49: *
50: * @param sDetails a <code>String</code> representation of the restrictions
51: * for this range
52: */
53: public URIRange(String sDetails) {
54: super (URL.class.getName(), sDetails);
55:
56: }
57:
58: /* (non-Javadoc)
59: * @see org.openharmonise.rm.resources.metadata.properties.ranges.Range#isValid(java.lang.Object)
60: */
61: public boolean isValid(Object obj) {
62: return obj instanceof URL;
63: }
64:
65: /* (non-Javadoc)
66: * @see java.lang.Object#equals(java.lang.Object)
67: */
68: public boolean equals(Object obj) {
69: boolean bResult = false;
70:
71: if (obj instanceof URIRange) {
72: bResult = super .equals(obj);
73: }
74:
75: return bResult;
76: }
77:
78: /* (non-Javadoc)
79: * @see org.openharmonise.rm.resources.metadata.properties.ranges.Range#getPropertyInstanceClass()
80: */
81: public Class getPropertyInstanceClass()
82: throws ClassNotFoundException {
83: return GeneralPropertyInstance.class;
84: }
85:
86: /* (non-Javadoc)
87: * @see org.openharmonise.rm.publishing.Publishable#getTagName()
88: */
89: public String getTagName() {
90: return TAG_URI_RANGE;
91: }
92: }
|