Tabnine Logo
IoCs.autoSet
Code IndexAdd Tabnine to your IDE (free)

How to use
autoSet
method
in
org.apache.sirona.configuration.ioc.IoCs

Best Java code snippets using org.apache.sirona.configuration.ioc.IoCs.autoSet (Showing top 4 results out of 315)

origin: org.apache.sirona/sirona-api

public static <T> T autoSet(final T instance) throws Exception {
  return autoSet(null, instance);
}
origin: org.apache.sirona/sirona-api

public static <T> T autoSet(final String key, final T instance) throws Exception {
  return autoSet(key, instance, instance.getClass());
}
origin: org.apache.sirona/sirona-api

private static <T> T internalProcessInstance(final T instance) throws Exception {
  final Class<?> loadedClass = instance.getClass();
  // autoset before invoking @Created
  if (loadedClass.getAnnotation(AutoSet.class) != null) {
    autoSet(null, instance, loadedClass);
  }
  Class<?> clazz = loadedClass;
  while (clazz != null && !Object.class.equals(clazz)) {
    for (final Method m : clazz.getDeclaredMethods()) {
      if (m.getAnnotation(Created.class) != null) {
        m.setAccessible(true);
        m.invoke(instance);
      } else if (m.getAnnotation(Destroying.class) != null) {
        m.setAccessible(true);
        if (shutdownHook == null == Configuration.is(Configuration.CONFIG_PROPERTY_PREFIX + "shutdown.hook", true)) {
          shutdownHook = new Thread() {
            @Override
            public void run() {
              shutdown();
            }
          };
          Runtime.getRuntime().addShutdownHook(shutdownHook);
        }
        INSTANCES.add(new ToDestroy(m, instance));
      }
    }
    clazz = clazz.getSuperclass();
  }
  return instance;
}
origin: org.apache.sirona/sirona-core

protected static Collection<AlertListener> findAlerters() {
  final Collection<AlertListener> listeners = new ArrayList<AlertListener>();
  final String alerters = Configuration.getProperty(Configuration.CONFIG_PROPERTY_PREFIX + "alerters", null);
  if (alerters != null && alerters.trim().length() > 0) {
    for (final String alert : alerters.split(" *, *")) {
      final String classKey = alert + ".class";
      final String type = Configuration.getProperty(classKey, null);
      if (type == null) {
        throw new IllegalArgumentException("Missing configuration " + classKey);
      }
      try {
        final Class<?> clazz = ClassLoaders.current().loadClass(type);
        final AlertListener listener = IoCs.autoSet(alert, AlertListener.class.cast(clazz.newInstance()));
        listeners.add(listener);
      } catch (final Exception e) {
        throw new IllegalArgumentException(e);
      }
    }
  }
  return listeners;
}
org.apache.sirona.configuration.iocIoCsautoSet

Popular methods of IoCs

  • findOrCreateInstance
  • processInstance
  • shutdown
  • convertTo
  • getInstance
  • internalProcessInstance
  • newInstance
  • setSingletonInstance

Popular in Java

  • Running tasks concurrently on multiple threads
  • compareTo (BigDecimal)
  • setScale (BigDecimal)
  • onCreateOptionsMenu (Activity)
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • JList (javax.swing)
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now