/** * Deserialize. * @param objectInputStream the input stream * @throws IOException if an IO error occurs * @throws ClassNotFoundException if the class cannot be resolved */ private void readObject(final ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException { @SuppressWarnings("unchecked") // Will throw CCE here if not correct final L[] srcListeners = (L[]) objectInputStream.readObject(); this.listeners = new CopyOnWriteArrayList<>(srcListeners); @SuppressWarnings("unchecked") // Will throw CCE here if not correct final Class<L> listenerInterface = (Class<L>) srcListeners.getClass().getComponentType(); initializeTransientFields(listenerInterface, Thread.currentThread().getContextClassLoader()); }
/** * Creates an EventListenerSupport object which supports the provided * listener interface using the specified class loader to create the JDK * dynamic proxy. * * @param listenerInterface the listener interface. * @param classLoader the class loader. * * @throws NullPointerException if <code>listenerInterface</code> or * <code>classLoader</code> is <code>null</code>. * @throws IllegalArgumentException if <code>listenerInterface</code> is * not an interface. */ public EventListenerSupport(final Class<L> listenerInterface, final ClassLoader classLoader) { this(); Validate.notNull(listenerInterface, "Listener interface cannot be null."); Validate.notNull(classLoader, "ClassLoader cannot be null."); Validate.isTrue(listenerInterface.isInterface(), "Class {0} is not an interface", listenerInterface.getName()); initializeTransientFields(listenerInterface, classLoader); }
/** * Deserialize. * @param objectInputStream the input stream * @throws IOException if an IO error occurs * @throws ClassNotFoundException if the class cannot be resolved */ private void readObject(final ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException { @SuppressWarnings("unchecked") // Will throw CCE here if not correct final L[] srcListeners = (L[]) objectInputStream.readObject(); this.listeners = new CopyOnWriteArrayList<>(srcListeners); @SuppressWarnings("unchecked") // Will throw CCE here if not correct final Class<L> listenerInterface = (Class<L>) srcListeners.getClass().getComponentType(); initializeTransientFields(listenerInterface, Thread.currentThread().getContextClassLoader()); }
/** * Deserialize. * @param objectInputStream the input stream * @throws IOException if an IO error occurs * @throws ClassNotFoundException if the class cannot be resolved */ private void readObject(final ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException { @SuppressWarnings("unchecked") // Will throw CCE here if not correct final L[] srcListeners = (L[]) objectInputStream.readObject(); this.listeners = new CopyOnWriteArrayList<>(srcListeners); @SuppressWarnings("unchecked") // Will throw CCE here if not correct final Class<L> listenerInterface = (Class<L>) srcListeners.getClass().getComponentType(); initializeTransientFields(listenerInterface, Thread.currentThread().getContextClassLoader()); }
/** * Deserialize. * @param objectInputStream the input stream * @throws IOException if an IO error occurs * @throws ClassNotFoundException if the class cannot be resolved */ private void readObject(final ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException { @SuppressWarnings("unchecked") // Will throw CCE here if not correct final L[] srcListeners = (L[]) objectInputStream.readObject(); this.listeners = new CopyOnWriteArrayList<>(srcListeners); @SuppressWarnings("unchecked") // Will throw CCE here if not correct final Class<L> listenerInterface = (Class<L>) srcListeners.getClass().getComponentType(); initializeTransientFields(listenerInterface, Thread.currentThread().getContextClassLoader()); }
/** * Creates an EventListenerSupport object which supports the provided * listener interface using the specified class loader to create the JDK * dynamic proxy. * * @param listenerInterface the listener interface. * @param classLoader the class loader. * * @throws NullPointerException if <code>listenerInterface</code> or * <code>classLoader</code> is <code>null</code>. * @throws IllegalArgumentException if <code>listenerInterface</code> is * not an interface. */ public EventListenerSupport(final Class<L> listenerInterface, final ClassLoader classLoader) { this(); Validate.notNull(listenerInterface, "Listener interface cannot be null."); Validate.notNull(classLoader, "ClassLoader cannot be null."); Validate.isTrue(listenerInterface.isInterface(), "Class {0} is not an interface", listenerInterface.getName()); initializeTransientFields(listenerInterface, classLoader); }
/** * Creates an EventListenerSupport object which supports the provided * listener interface using the specified class loader to create the JDK * dynamic proxy. * * @param listenerInterface the listener interface. * @param classLoader the class loader. * * @throws NullPointerException if <code>listenerInterface</code> or * <code>classLoader</code> is <code>null</code>. * @throws IllegalArgumentException if <code>listenerInterface</code> is * not an interface. */ public EventListenerSupport(final Class<L> listenerInterface, final ClassLoader classLoader) { this(); Validate.notNull(listenerInterface, "Listener interface cannot be null."); Validate.notNull(classLoader, "ClassLoader cannot be null."); Validate.isTrue(listenerInterface.isInterface(), "Class {0} is not an interface", listenerInterface.getName()); initializeTransientFields(listenerInterface, classLoader); }
/** * Creates an EventListenerSupport object which supports the provided * listener interface using the specified class loader to create the JDK * dynamic proxy. * * @param listenerInterface the listener interface. * @param classLoader the class loader. * * @throws NullPointerException if <code>listenerInterface</code> or * <code>classLoader</code> is <code>null</code>. * @throws IllegalArgumentException if <code>listenerInterface</code> is * not an interface. */ public EventListenerSupport(final Class<L> listenerInterface, final ClassLoader classLoader) { this(); Validate.notNull(listenerInterface, "Listener interface cannot be null."); Validate.notNull(classLoader, "ClassLoader cannot be null."); Validate.isTrue(listenerInterface.isInterface(), "Class {0} is not an interface", listenerInterface.getName()); initializeTransientFields(listenerInterface, classLoader); }