public class MockServiceReference extends Object implements org.osgi.framework.ServiceReference
Constants.SERVICE_ID
, Constants.OBJECTCLASS
and
Constants.SERVICE_RANKING
.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,
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,
Dictionary properties,
org.osgi.framework.ServiceRegistration registration,
String[] classes)
Constructs a new
MockServiceReference instance. |
MockServiceReference(org.osgi.framework.Bundle bundle,
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(String[] classes)
Constructs a new
MockServiceReference instance matching
the given class namess. |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Object reference) |
boolean |
equals(Object obj)
Two mock service references are equal if they contain the same service
id.
|
org.osgi.framework.Bundle |
getBundle() |
Object |
getProperty(String key) |
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,
String className) |
void |
setProperties(Dictionary properties)
Sets the properties associated with this reference.
|
String |
toString() |
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(String[] classes)
MockServiceReference
instance matching
the given class namess.classes
- associated class namespublic MockServiceReference(org.osgi.framework.Bundle bundle, 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, 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, Dictionary properties, org.osgi.framework.ServiceRegistration registration, 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 namespublic org.osgi.framework.Bundle getBundle()
getBundle
in interface org.osgi.framework.ServiceReference
public Object getProperty(String key)
getProperty
in interface org.osgi.framework.ServiceReference
public String[] getPropertyKeys()
getPropertyKeys
in interface org.osgi.framework.ServiceReference
public org.osgi.framework.Bundle[] getUsingBundles()
getUsingBundles
in interface org.osgi.framework.ServiceReference
public boolean isAssignableTo(org.osgi.framework.Bundle bundle, String className)
isAssignableTo
in interface org.osgi.framework.ServiceReference
public void setProperties(Dictionary properties)
properties
- public boolean equals(Object obj)
public int hashCode()
public int compareTo(Object reference)
compareTo
in interface Comparable
compareTo
in interface org.osgi.framework.ServiceReference
Copyright © 2006-2013. All Rights Reserved.