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

org.vraptor.util.StatsQuery Maven / Gradle / Ivy

Go to download

mvc and ioc controller based on java 5 annotations and conventions

There is a newer version: 2.6.2
Show newest version
package org.vraptor.util;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

import org.vraptor.component.ComponentType;
import org.vraptor.plugin.VRaptorPlugin;
import org.vraptor.webapp.WebApplication;

/**
 * Outjects components and plugins variables.
 * 
 * @author Guilherme Silveira
 */
public class StatsQuery {

	/**
	 * Compares the name of two ComponentType, ignoring case. Note: this
	 * comparator imposes orderings that are inconsistent with equals
	 */
	class ComponentTypeNameComparator implements Comparator {

		public int compare(ComponentType c1, ComponentType c2) {
			return c1.getName().compareToIgnoreCase(c2.getName());
		}
	}

	private List components;

	private List plugins;

	private final WebApplication webApplication;

	public StatsQuery(WebApplication webApplication) {
		this.webApplication = webApplication;
	}

	public List getComponents() {
		return components;
	}

	public List getPlugins() {
		return plugins;
	}

	public void read() {

		this.components = new ArrayList(this.webApplication.getComponentManager().getComponents());
		Collections.sort(this.components, new ComponentTypeNameComparator());

		this.plugins = this.webApplication.getPluginManager().getPlugins();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy