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

com.github.edgarespina.mwa.Beans Maven / Gradle / Ivy

package com.github.edgarespina.mwa;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import org.springframework.context.ApplicationContext;

/**
 * Helper class for beans.
 *
 * @author edgar.espina
 * @since 0.1.3
 */
public final class Beans {

  /**
   * Not allowed.
   */
  private Beans() {
  }

  /**
   * Look for bean of an specific type in the Application Context.
   *
   * @param context The application context.
   * @param beanType The bean type to look for.
   * @param  The bean generic type.
   * @return All the of the specific types found in the Application Context.
   */
  public static  List lookFor(final ApplicationContext context,
      final Class beanType) {
    Collection beans = context.getBeansOfType(beanType).values();
    List result = new ArrayList();
    if (beans != null) {
      result.addAll(beans);
    }
    return result;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy