org.eclipse.edje/src/main/java/org/eclipse/edje/DefaultPeripheralRegistry.java
private <P extends Peripheral> void executeEvent(Pump<RegistrationEvent<?>> pump, RegistrationEvent<P> data,
			ClassFilter<P> classFilter) {
		Class<P>[] registeredClasses = getRegisteredClasses(classFilter);
		if (data.isRegistration()) {
			for (Class<P> c : registeredClasses) {
				ClassRecord<P> cr = getPeripheralClassRecord(c);

				for (RegistrationListener<P> listener : cr.listeners) {
					try {
						try {
							checkRead(c, data.getPeripheral());
						} catch (SecurityException ex) {
							// we skip this if you can't read it
							continue;
						}
						listener.peripheralRegistered(data);
					} catch (Throwable e) {
						pump.crash(e);
					}
				}
			}
		} else {
			// Peripheral unregistered: notify listeners for all supertypes of
			// the peripheral class
			for (Class<P> c : registeredClasses) {
				ClassRecord<P> cr = getPeripheralClassRecord(c);
				for (RegistrationListener<P> listener : cr.listeners) {
					try {
						try {
							checkRead(c, data.getPeripheral());
						} catch (SecurityException ex) {
							// we skip this if you can't read it
							continue;
						}
						listener.peripheralUnregistered(data);
					} catch (Throwable e) {
						pump.crash(e);
					}
				}
			}
		}
	}
/**
	 * Notifies the listeners on a registration / unregistration event.
	 *
	 * @param pump
	 *            the pump which manages the pool of events
	 * @param data
	 *            the registration event
	 * @param classFilter
	 *            the type of the peripheral
	 */
Notifies the listeners on a registration / unregistration event.
@param pump
the pump which manages the pool of events
@param data
the registration event
@param classFilter
the type of the peripheral
Notifies the listeners on a registration / unregistration event . @param pump the pump which manages the pool of events @param data the registration event @param classFilter the type of the peripheral
private <P extends Peripheral> void executeEvent(Pump<RegistrationEvent<?>> pump, RegistrationEvent<P> data,
			ClassFilter<P> classFilter) {
		Class<P>[] registeredClasses = getRegisteredClasses(classFilter);
		if (data.isRegistration()) {
			for (Class<P> c : registeredClasses) {
				ClassRecord<P> cr = getPeripheralClassRecord(c);
				for (RegistrationListener<P> listener : cr.listeners) {
					try {
						try {
							checkRead(c, data.getPeripheral());
						} catch (SecurityException ex) {
							continue;
						}
						listener.peripheralRegistered(data);
					} catch (Throwable e) {
						pump.crash(e);
					}
				}
			}
		} else {
			for (Class<P> c : registeredClasses) {
				ClassRecord<P> cr = getPeripheralClassRecord(c);
				for (RegistrationListener<P> listener : cr.listeners) {
					try {
						try {
							checkRead(c, data.getPeripheral());
						} catch (SecurityException ex) {
							continue;
						}
						listener.peripheralUnregistered(data);
					} catch (Throwable e) {
						pump.crash(e);
					}
				}
			}
		}
	}
private < P extends Peripheral > void executeEvent ( Pump < RegistrationEvent < ? > > pump , RegistrationEvent < P > data , ClassFilter < P > classFilter ) { Class < P > [ ] registeredClasses = getRegisteredClasses ( classFilter ) ; if ( data . isRegistration ( ) ) { for ( Class < P > c : registeredClasses ) { ClassRecord < P > cr = getPeripheralClassRecord ( c ) ; for ( RegistrationListener < P > listener : cr . listeners ) { try { try { checkRead ( c , data . getPeripheral ( ) ) ; } catch ( SecurityException ex ) { continue ; } listener . peripheralRegistered ( data ) ; } catch ( Throwable e ) { pump . crash ( e ) ; } } } } else { for ( Class < P > c : registeredClasses ) { ClassRecord < P > cr = getPeripheralClassRecord ( c ) ; for ( RegistrationListener < P > listener : cr . listeners ) { try { try { checkRead ( c , data . getPeripheral ( ) ) ; } catch ( SecurityException ex ) { continue ; } listener . peripheralUnregistered ( data ) ; } catch ( Throwable e ) { pump . crash ( e ) ; } } } } }
Notifies the listeners on a registration / unregistration event.
Notifies the listeners on a registration / unregistration event .
// we skip this if you can't read it // Peripheral unregistered: notify listeners for all supertypes of // the peripheral class // we skip this if you can't read it