Debian Codegraph @

src/org/osgi/resource/Requirement.java

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
•1 /*
2 * Copyright (c) OSGi Alliance (2011, 2013). All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package org.osgi.resource;
18
19 import java.util.Map;
20 import org.osgi.annotation.versioning.ConsumerType;
21
22 /**
23 * A requirement that has been declared from a {@link Resource} .
24 *
25 * <p>
26 * Instances of this type must be <i>effectively immutable</i>. That is, for a
27 * given instance of this interface, the methods defined by this interface must
28 * always return the same result.
29 *
30 * @ThreadSafe
31 * @author $Id: 252221aeaaf9b189eef6e0c3798d0076a0032242 $
32 */
33 @ConsumerType
34 public interface Requirement {
35 /**
36 * Returns the namespace of this requirement.
37 *
38 * @return The namespace of this requirement.
39 */
40 String getNamespace();
41
42 /**
43 * Returns the directives of this requirement.
44 *
45 * @return An unmodifiable map of directive names to directive values for
46 * this requirement, or an empty map if this requirement has no
47 * directives.
48 */
49 Map<String, String> getDirectives();
50
51 /**
52 * Returns the attributes of this requirement.
53 *
54 * <p>
55 * Requirement attributes have no specified semantics and are considered
56 * extra user defined information.
57 *
58 * @return An unmodifiable map of attribute names to attribute values for
59 * this requirement, or an empty map if this requirement has no
60 * attributes.
61 */
62 Map<String, Object> getAttributes();
63
64 /**
65 * Returns the resource declaring this requirement.
66 *
67 * @return The resource declaring this requirement. This can be {@code null}
68 * if this requirement is synthesized.
69 */
70 Resource getResource();
71
72 /**
73 * Compares this {@code Requirement} to another {@code Requirement}.
74 *
75 * <p>
76 * This {@code Requirement} is equal to another {@code Requirement} if they
77 * have the same namespace, directives and attributes and are declared by
78 * the same resource.
79 *
80 * @param obj The object to compare against this {@code Requirement}.
81 * @return {@code true} if this {@code Requirement} is equal to the other
82 * object; {@code false} otherwise.
83 */
84 boolean equals(Object obj);
85
86 /**
87 * Returns the hashCode of this {@code Requirement}.
88 *
89 * @return The hashCode of this {@code Requirement}.
90 */
91 int hashCode();
92 }