} else {
wireContext = targetWireContext;
}
if (wireEvents) {
WireDefinition wireDefinition = wireContext.getWireDefinition();
// if there are objectNames specified
if (objectNames!=null) {
// subscribe to the descriptors for the all objectNames
for (String objectName: objectNames) {
Descriptor descriptor = wireDefinition.getDescriptor(objectName);
subscribe(listener, descriptor);
}
// if no objectNames are specified, subscribe to all the descriptors
} else {
Set<Descriptor> descriptors = new HashSet<Descriptor>(wireDefinition.getDescriptors().values());
for(Descriptor descriptor: descriptors) {
subscribe(listener, descriptor);
}
}