コード例 #1
0
  /**
   * Adds <tt>listener</tt> to the list of {@link CapsVerListener}s that we notify when new features
   * occur and the version hash needs to be regenerated. The method would also notify
   * <tt>listener</tt> if our current caps version has been generated and is different than
   * <tt>null</tt>.
   *
   * @param listener the {@link CapsVerListener} we'd like to register.
   */
  public void addCapsVerListener(CapsVerListener listener) {
    synchronized (capsVerListeners) {
      if (capsVerListeners.contains(listener)) return;

      capsVerListeners.add(listener);

      if (currentCapsVersion != null) listener.capsVerUpdated(currentCapsVersion);
    }
  }
コード例 #2
0
 /**
  * Removes <tt>listener</tt> from the list of currently registered {@link CapsVerListener}s.
  *
  * @param listener the {@link CapsVerListener} we'd like to unregister.
  */
 public void removeCapsVerListener(CapsVerListener listener) {
   synchronized (capsVerListeners) {
     capsVerListeners.remove(listener);
   }
 }