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
* @version $Id: $Id
*/
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>());
}
/**
* addCMSViewHelper.
*
* @param documentPath a {@link java.lang.String} object.
* @param helper a {@link net.anotheria.asg.util.helper.cmsview.CMSViewHelper} object.
*/
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);
}
/**
* getCMSViewHelpers.
*
* @param documentPath a {@link java.lang.String} object.
* @return a {@link java.util.List} object.
*/
public static List getCMSViewHelpers(String documentPath){
List ret = helperMap.get(documentPath);
return ret == null ? EMPTY_LIST : ret;
}
}