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

net.anotheria.asg.util.helper.cmsview.CMSViewHelperRegistry Maven / Gradle / Ivy

package net.anotheria.asg.util.helper.cmsview;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Container for the view helpers.
 * @author lrosenberg
 *
 */
public class CMSViewHelperRegistry {
	/**
	 * A map with the helpers.
	 */
	private static Map> helperMap;
	/**
	 * An empty list as null object.
	 */
	private static final ArrayList EMPTY_LIST = new ArrayList(0);

	private CMSViewHelperRegistry() {
	}

	static{
		helperMap = Collections.synchronizedMap(new HashMap>());
	}
	
	public static void addCMSViewHelper(String documentPath, CMSViewHelper helper){
		List helpers = helperMap.get(documentPath);
		if (helpers==null){
			helpers = new ArrayList();
			helperMap.put(documentPath, helpers);
		}
		helpers.add(helper);
		
	}
	
	public static List getCMSViewHelpers(String documentPath){
		List ret = helperMap.get(documentPath);
		return ret == null ? EMPTY_LIST : ret;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy