All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.gerrit.lifecycle.LifecycleModule Maven / Gradle / Ivy

There is a newer version: 3.10.0-rc4
Show newest version
package com.google.gerrit.lifecycle;

import com.google.gerrit.extensions.config.FactoryModule;
import com.google.gerrit.extensions.events.LifecycleListener;
import com.google.inject.Singleton;
import com.google.inject.binder.LinkedBindingBuilder;
import com.google.inject.internal.UniqueAnnotations;
import java.lang.annotation.Annotation;

/** Module to support registering a unique LifecyleListener. */
public abstract class LifecycleModule extends FactoryModule {
  /**
   * @return a unique listener binding.
   *     

To create a listener binding use: *

   * listener().to(MyListener.class);
   * 
* where {@code MyListener} is a {@link Singleton} implementing the {@link LifecycleListener} * interface. */ protected LinkedBindingBuilder listener() { final Annotation id = UniqueAnnotations.create(); return bind(LifecycleListener.class).annotatedWith(id); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy