public class MockServiceReference
extends java.lang.Object
implements org.osgi.framework.ServiceReference
Constants.SERVICE_ID, Constants.OBJECTCLASS and
Constants.SERVICE_RANKING.| Modifier and Type | Field and Description |
|---|---|
private org.osgi.framework.Bundle |
bundle |
private static long |
GLOBAL_SERVICE_ID |
private java.lang.String[] |
objectClass |
private java.util.Dictionary |
properties |
private long |
serviceId |
| Constructor and Description |
|---|
MockServiceReference()
Constructs a new
MockServiceReference instance using
defaults. |
MockServiceReference(org.osgi.framework.Bundle bundle)
Constructs a new
MockServiceReference instance associated
with the given bundle. |
MockServiceReference(org.osgi.framework.Bundle bundle,
java.util.Dictionary properties,
org.osgi.framework.ServiceRegistration registration)
Constructs a new
MockServiceReference instance associated
with the given bundle, service registration and having the given service
properties. |
MockServiceReference(org.osgi.framework.Bundle bundle,
java.util.Dictionary properties,
org.osgi.framework.ServiceRegistration registration,
java.lang.String[] classes)
Constructs a new
MockServiceReference instance. |
MockServiceReference(org.osgi.framework.Bundle bundle,
java.lang.String[] classes)
Constructs a new
MockServiceReference instance associated
with the given bundle and matching the given class names. |
MockServiceReference(org.osgi.framework.ServiceRegistration registration)
Constructs a new
MockServiceReference instance associated
with the given service registration. |
MockServiceReference(java.lang.String[] classes)
Constructs a new
MockServiceReference instance matching
the given class namess. |
| Modifier and Type | Method and Description |
|---|---|
private void |
addMandatoryProperties(java.util.Dictionary dict) |
int |
compareTo(java.lang.Object reference) |
boolean |
equals(java.lang.Object obj)
Two mock service references are equal if they contain the same service
id.
|
org.osgi.framework.Bundle |
getBundle() |
java.lang.Object |
getProperty(java.lang.String key) |
java.lang.String[] |
getPropertyKeys() |
org.osgi.framework.Bundle[] |
getUsingBundles() |
int |
hashCode()
Returns a hash code based on the class and service id.
|
boolean |
isAssignableTo(org.osgi.framework.Bundle bundle,
java.lang.String className) |
void |
setProperties(java.util.Dictionary properties)
Sets the properties associated with this reference.
|
java.lang.String |
toString() |
private org.osgi.framework.Bundle bundle
private static long GLOBAL_SERVICE_ID
private long serviceId
private java.util.Dictionary properties
private java.lang.String[] objectClass
public MockServiceReference()
MockServiceReference instance using
defaults.public MockServiceReference(org.osgi.framework.Bundle bundle)
MockServiceReference instance associated
with the given bundle.bundle - associated reference bundlepublic MockServiceReference(java.lang.String[] classes)
MockServiceReference instance matching
the given class namess.classes - associated class namespublic MockServiceReference(org.osgi.framework.Bundle bundle,
java.lang.String[] classes)
MockServiceReference instance associated
with the given bundle and matching the given class names.bundle - associated bundleclasses - matching class namespublic MockServiceReference(org.osgi.framework.ServiceRegistration registration)
MockServiceReference instance associated
with the given service registration.registration - service registrationpublic MockServiceReference(org.osgi.framework.Bundle bundle,
java.util.Dictionary properties,
org.osgi.framework.ServiceRegistration registration)
MockServiceReference instance associated
with the given bundle, service registration and having the given service
properties.bundle - associated bundleproperties - reference propertiesregistration - associated service registrationspublic MockServiceReference(org.osgi.framework.Bundle bundle,
java.util.Dictionary properties,
org.osgi.framework.ServiceRegistration registration,
java.lang.String[] classes)
MockServiceReference instance. This
constructor gives access to all the parameters of the mock service
reference such as associated bundle, reference properties, service
registration and reference class names.bundle - associated bundleproperties - reference propertiesregistration - service registrationclasses - reference class namesprivate void addMandatoryProperties(java.util.Dictionary dict)
public org.osgi.framework.Bundle getBundle()
getBundle in interface org.osgi.framework.ServiceReferencepublic java.lang.Object getProperty(java.lang.String key)
getProperty in interface org.osgi.framework.ServiceReferencepublic java.lang.String[] getPropertyKeys()
getPropertyKeys in interface org.osgi.framework.ServiceReferencepublic org.osgi.framework.Bundle[] getUsingBundles()
getUsingBundles in interface org.osgi.framework.ServiceReferencepublic boolean isAssignableTo(org.osgi.framework.Bundle bundle,
java.lang.String className)
isAssignableTo in interface org.osgi.framework.ServiceReferencepublic void setProperties(java.util.Dictionary properties)
properties - public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic int compareTo(java.lang.Object reference)
compareTo in interface java.lang.ComparablecompareTo in interface org.osgi.framework.ServiceReference