1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.springframework.osgi.service.importer.support.internal.aop;
18
19 import org.osgi.framework.ServiceReference;
20 import org.springframework.aop.support.DelegatingIntroductionInterceptor;
21 import org.springframework.osgi.service.importer.ImportedOsgiServiceProxy;
22 import org.springframework.osgi.service.importer.ServiceReferenceProxy;
23 import org.springframework.util.Assert;
24
25 /**
26 * Mix-in implementation for ImportedOsgiServiceProxy.
27 *
28 * @author Costin Leau
29 *
30 */
31 public class ImportedOsgiServiceProxyAdvice extends DelegatingIntroductionInterceptor implements
32 ImportedOsgiServiceProxy {
33
34 private static final long serialVersionUID = 6455437774724678999L;
35
36 private static final int hashCode = ImportedOsgiServiceProxyAdvice.class.hashCode() * 13;
37
38 private final transient ServiceReferenceProxy reference;
39
40
41 public ImportedOsgiServiceProxyAdvice(ServiceReference reference) {
42 Assert.notNull(reference);
43 this.reference = (reference instanceof ServiceReferenceProxy ? (ServiceReferenceProxy) reference
44 : new StaticServiceReferenceProxy(reference));
45 }
46
47 public ServiceReferenceProxy getServiceReference() {
48 return reference;
49 }
50
51 public boolean equals(Object other) {
52 if (this == other)
53 return true;
54 if (other instanceof ImportedOsgiServiceProxyAdvice) {
55 ImportedOsgiServiceProxyAdvice oth = (ImportedOsgiServiceProxyAdvice) other;
56 return (reference.equals(oth.reference));
57 }
58 else
59 return false;
60 }
61
62 public int hashCode() {
63 return hashCode;
64 }
65 }