|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.osgi.mock.MockServiceReference
public class MockServiceReference
ServiceReference mock.
This mock tries to adhere to the OSGi spec as much as possible by providing the mandatory serviceId properties such asConstants.SERVICE_ID
, Constants.OBJECTCLASS
and
Constants.SERVICE_RANKING
.
Constructor Summary | |
---|---|
MockServiceReference()
Constructs a new MockServiceReference instance using
defaults. |
|
MockServiceReference(Bundle bundle)
Constructs a new MockServiceReference instance associated
with the given bundle. |
|
MockServiceReference(Bundle bundle,
Dictionary properties,
ServiceRegistration registration)
Constructs a new MockServiceReference instance associated
with the given bundle, service registration and having the given service
properties. |
|
MockServiceReference(Bundle bundle,
Dictionary properties,
ServiceRegistration registration,
String[] classes)
Constructs a new MockServiceReference instance. |
|
MockServiceReference(Bundle bundle,
String[] classes)
Constructs a new MockServiceReference instance associated
with the given bundle and matching the given class names. |
|
MockServiceReference(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. |
Method Summary | |
---|---|
int |
compareTo(Object reference)
|
boolean |
equals(Object obj)
Two mock service references are equal if they contain the same service id. |
Bundle |
getBundle()
|
Object |
getProperty(String key)
|
String[] |
getPropertyKeys()
|
Bundle[] |
getUsingBundles()
|
int |
hashCode()
Returns a hash code based on the class and service id. |
boolean |
isAssignableTo(Bundle bundle,
String className)
|
void |
setProperties(Dictionary properties)
Sets the properties associated with this reference. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MockServiceReference()
MockServiceReference
instance using
defaults.
public MockServiceReference(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(Bundle bundle, String[] classes)
MockServiceReference
instance associated
with the given bundle and matching the given class names.
bundle
- associated bundleclasses
- matching class namespublic MockServiceReference(ServiceRegistration registration)
MockServiceReference
instance associated
with the given service registration.
registration
- service registrationpublic MockServiceReference(Bundle bundle, Dictionary properties, 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(Bundle bundle, Dictionary properties, 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 namesMethod Detail |
---|
public Bundle getBundle()
getBundle
in interface ServiceReference
public Object getProperty(String key)
getProperty
in interface ServiceReference
public String[] getPropertyKeys()
getPropertyKeys
in interface ServiceReference
public Bundle[] getUsingBundles()
getUsingBundles
in interface ServiceReference
public boolean isAssignableTo(Bundle bundle, String className)
isAssignableTo
in interface ServiceReference
public void setProperties(Dictionary properties)
properties
- public boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
public int compareTo(Object reference)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |