comparison org.eclipse.osgi/osgi/src/org/osgi/framework/Filter.d @ 105:bbe49769ec18

...
author Frank Benoit <benoit@tionex.de>
date Sun, 08 Nov 2009 12:42:30 +0100
parents 12b890a6392a
children
comparison
equal deleted inserted replaced
104:88652073d1c2 105:bbe49769ec18
1 /* 1 /*
2 * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/Filter.java,v 1.16 2007/02/21 16:49:05 hargrave Exp $ 2 * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/Filter.java,v 1.16 2007/02/21 16:49:05 hargrave Exp $
3 * 3 *
4 * Copyright (c) OSGi Alliance (2000, 2007). All Rights Reserved. 4 * Copyright (c) OSGi Alliance (2000, 2007). All Rights Reserved.
5 * 5 *
6 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License. 7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at 8 * You may obtain a copy of the License at
9 * 9 *
10 * http://www.apache.org/licenses/LICENSE-2.0 10 * http://www.apache.org/licenses/LICENSE-2.0
13 * distributed under the License is distributed on an "AS IS" BASIS, 13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and 15 * See the License for the specific language governing permissions and
16 * limitations under the License. 16 * limitations under the License.
17 */ 17 */
18 // Port to the D programming language:
19 // Frank Benoit <benoit@tionex.de>
18 module org.osgi.framework.Filter; 20 module org.osgi.framework.Filter;
19 import org.osgi.framework.ServiceReference;
20 21
21 import java.lang.all; 22 import java.lang.all;
23
24 import org.osgi.framework.ServiceReference; // packageimport
25
22 import java.util.Dictionary; 26 import java.util.Dictionary;
23 27
24 /** 28 /**
25 * An RFC 1960-based Filter. 29 * An RFC 1960-based Filter.
26 * <p> 30 * <p>
30 * A <code>Filter</code> object can be used numerous times to determine if the 34 * A <code>Filter</code> object can be used numerous times to determine if the
31 * match argument matches the filter string that was used to create the 35 * match argument matches the filter string that was used to create the
32 * <code>Filter</code> object. 36 * <code>Filter</code> object.
33 * <p> 37 * <p>
34 * Some examples of LDAP filters are: 38 * Some examples of LDAP filters are:
35 * 39 *
36 * <pre> 40 * <pre>
37 * &quot;(cn=Babs Jensen)&quot; 41 * &quot;(cn=Babs Jensen)&quot;
38 * &quot;(!(cn=Tim Howes))&quot; 42 * &quot;(!(cn=Tim Howes))&quot;
39 * &quot;(&amp;(&quot; + Constants.OBJECTCLASS + &quot;=Person)(|(sn=Jensen)(cn=Babs J*)))&quot; 43 * &quot;(&amp;(&quot; + Constants.OBJECTCLASS + &quot;=Person)(|(sn=Jensen)(cn=Babs J*)))&quot;
40 * &quot;(o=univ*of*mich*)&quot; 44 * &quot;(o=univ*of*mich*)&quot;
41 * </pre> 45 * </pre>
42 * 46 *
43 * @since 1.1 47 * @since 1.1
44 * @see "Core Specification, section 5.5, for a description of the filter string 48 * @see "Core Specification, section 5.5, for a description of the filter string
45 * syntax." 49 * syntax."
46 * @ThreadSafe 50 * @ThreadSafe
47 * @version $Revision: 1.16 $ 51 * @version $Revision: 1.16 $
51 * Filter using a service's properties. 55 * Filter using a service's properties.
52 * <p> 56 * <p>
53 * The filter is executed using the keys and values of the referenced 57 * The filter is executed using the keys and values of the referenced
54 * service's properties. The keys are case insensitively matched with the 58 * service's properties. The keys are case insensitively matched with the
55 * filter. 59 * filter.
56 * 60 *
57 * @param reference The reference to the service whose properties are used 61 * @param reference The reference to the service whose properties are used
58 * in the match. 62 * in the match.
59 * 63 *
60 * @return <code>true</code> if the service's properties match this 64 * @return <code>true</code> if the service's properties match this
61 * filter; <code>false</code> otherwise. 65 * filter; <code>false</code> otherwise.
62 */ 66 */
63 public bool match(ServiceReference reference); 67 public bool match(ServiceReference reference);
64 68
65 /** 69 /**
66 * Filter using a <code>Dictionary</code> object. The Filter is executed 70 * Filter using a <code>Dictionary</code> object. The Filter is executed
67 * using the <code>Dictionary</code> object's keys and values. The keys 71 * using the <code>Dictionary</code> object's keys and values. The keys
68 * are case insensitively matched with the filter. 72 * are case insensitively matched with the filter.
69 * 73 *
70 * @param dictionary The <code>Dictionary</code> object whose keys are 74 * @param dictionary The <code>Dictionary</code> object whose keys are
71 * used in the match. 75 * used in the match.
72 * 76 *
73 * @return <code>true</code> if the <code>Dictionary</code> object's 77 * @return <code>true</code> if the <code>Dictionary</code> object's
74 * keys and values match this filter; <code>false</code> 78 * keys and values match this filter; <code>false</code>
75 * otherwise. 79 * otherwise.
76 * 80 *
77 * @throws IllegalArgumentException If <code>dictionary</code> contains 81 * @throws IllegalArgumentException If <code>dictionary</code> contains
78 * case variants of the same key name. 82 * case variants of the same key name.
79 */ 83 */
80 public bool match(Dictionary dictionary); 84 public bool match(Dictionary dictionary);
81 85
82 /** 86 /**
83 * Returns this <code>Filter</code> object's filter string. 87 * Returns this <code>Filter</code> object's filter string.
84 * <p> 88 * <p>
85 * The filter string is normalized by removing whitespace which does not 89 * The filter string is normalized by removing whitespace which does not
86 * affect the meaning of the filter. 90 * affect the meaning of the filter.
87 * 91 *
88 * @return Filter string. 92 * @return Filter string.
89 */ 93 */
90 public String toString(); 94 public String toString();
91 95
92 /** 96 /**
93 * Compares this <code>Filter</code> object to another object. 97 * Compares this <code>Filter</code> object to another object.
94 * 98 *
95 * @param obj The object to compare against this <code>Filter</code> 99 * @param obj The object to compare against this <code>Filter</code>
96 * object. 100 * object.
97 * 101 *
98 * @return If the other object is a <code>Filter</code> object, then 102 * @return If the other object is a <code>Filter</code> object, then
99 * returns <code>this.toString().equals(obj.toString()</code>;<code>false</code> 103 * returns <code>this.toString().equals(obj.toString()</code>;<code>false</code>
100 * otherwise. 104 * otherwise.
101 */ 105 */
102 public bool equals(Object obj); 106 public equals_t opEquals(Object obj);
103 107
104 /** 108 /**
105 * Returns the hashCode for this <code>Filter</code> object. 109 * Returns the hashCode for this <code>Filter</code> object.
106 * 110 *
107 * @return The hashCode of the filter string; that is, 111 * @return The hashCode of the filter string; that is,
108 * <code>this.toString().hashCode()</code>. 112 * <code>this.toString().hashCode()</code>.
109 */ 113 */
110 public int hashCode(); 114 public hash_t toHash();
111 115
112 /** 116 /**
113 * Filter with case sensitivity using a <code>Dictionary</code> object. 117 * Filter with case sensitivity using a <code>Dictionary</code> object.
114 * The Filter is executed using the <code>Dictionary</code> object's keys 118 * The Filter is executed using the <code>Dictionary</code> object's keys
115 * and values. The keys are case sensitively matched with the filter. 119 * and values. The keys are case sensitively matched with the filter.
116 * 120 *
117 * @param dictionary The <code>Dictionary</code> object whose keys are 121 * @param dictionary The <code>Dictionary</code> object whose keys are
118 * used in the match. 122 * used in the match.
119 * 123 *
120 * @return <code>true</code> if the <code>Dictionary</code> object's 124 * @return <code>true</code> if the <code>Dictionary</code> object's
121 * keys and values match this filter; <code>false</code> 125 * keys and values match this filter; <code>false</code>
122 * otherwise. 126 * otherwise.
123 * 127 *
124 * @since 1.3 128 * @since 1.3
125 */ 129 */
126 public bool matchCase(Dictionary dictionary); 130 public bool matchCase(Dictionary dictionary);
127 } 131 }