Ejemplo n.º 1
0
  /**
   * Returns an empty processor iterator if no processors are on the relevant path, otherwise if
   * processors are present, logs an error. Called when a service loader is unavailable for some
   * reason, either because a service loader class cannot be found or because a security policy
   * prevents class loaders from being created.
   *
   * @param key The resource key to use to log an error message
   * @param e If non-null, pass this exception to Abort
   */
  private Iterator<Processor> handleServiceLoaderUnavailability(String key, Exception e) {
    JavaFileManager fileManager = context.get(JavaFileManager.class);

    if (fileManager instanceof JavacFileManager) {
      StandardJavaFileManager standardFileManager = (JavacFileManager) fileManager;
      Iterable<? extends File> workingPath =
          fileManager.hasLocation(ANNOTATION_PROCESSOR_PATH)
              ? standardFileManager.getLocation(ANNOTATION_PROCESSOR_PATH)
              : standardFileManager.getLocation(CLASS_PATH);

      if (needClassLoader(options.get(PROCESSOR), workingPath)) handleException(key, e);

    } else {
      handleException(key, e);
    }

    java.util.List<Processor> pl = Collections.emptyList();
    return pl.iterator();
  }
Ejemplo n.º 2
0
  /**
   * Fire a property change event to each listener.
   *
   * @param bean Bean being edited.
   * @param propName Name of the property.
   * @param oldValue Old value.
   * @param newValue New value.
   */
  protected void firePropertyChange(
      Object bean, String propName, Object oldValue, Object newValue) {

    PropertyChangeEvent e = new PropertyChangeEvent(bean, propName, oldValue, newValue);

    Iterator it = _changeListeners.iterator();
    while (it.hasNext()) {
      PropertyChangeListener l = (PropertyChangeListener) it.next();
      l.propertyChange(e);
    }
  }
Ejemplo n.º 3
0
 /**
  * Remove the given property change listener.
  *
  * @param l Listener to remove.
  */
 public void removePropertyChangeListener(PropertyChangeListener l) {
   _changeListeners.remove(l);
 }
Ejemplo n.º 4
0
 /**
  * Add the given listener. Will receive a change event for changes to the bean being edited.
  *
  * @param l Listner to add.
  */
 public void addPropertyChangeListener(PropertyChangeListener l) {
   _changeListeners.add(l);
 }