The table below describes the complex types:
From |
To |
Syntax |
Notes |
Example |
|---|---|---|---|---|
String |
Bundle[] |
<bundleId> <fromBundleId>-<toBundleId> (LDAP filter) simple pattern |
Refer to BundleUtils#getBundles() LDAP filter is matched against the bundle headers Simple pattern is a matched as a substring, or it might contain '*' to match group of characters |
10 10-20 (Bundle-Vendor=Bosch.IO) *.api |
String |
Bundle |
– |
Оnly the first matching entity is taken |
– |
String |
Filter |
– |
Standard filter syntax is used, without backspaces |
– |
String |
ServiceReference[] |
<id> <pid> <class> <LDAP filter> |
When matching a class name, the following filter is created "(objectclass=*ClassName)". So you don't need to specify the whole package of the service |
10 mbs.http.pid HttpService (openPort=*) |
String |
ServiceReference |
– |
Оnly the first matching entity is taken |
– |
If the above conversion cannot be applied to a parameter, the built-in resolver will attempt to resolve it as service.
Example:
@Command
public void ls(HttpService http) {
println("Aliases: %s", http.getAliases())
}
In the above example, the parameter "http" cannot be mapped, using any of the rules above, it will be obtained from the service registry.
In the following case you might specify an additional filter for those devices. If you call the command using:
"upnp.ls -f (UPnP.device.IP=localhost)"
then the 'devices' parameter will be filled with UPNPDevice services, that match the specified filter:
@Command
public void ls(@Option(name="f", default="") UPNPDevice[] devices) {
}