public class CachingInstanceTemplateManager extends java.lang.Object implements InstanceTemplateManager
Modifier and Type | Field and Description |
---|---|
private java.util.ArrayList<java.lang.Integer> |
allowedFormTypes |
private boolean |
restrictFormTypes |
private java.util.HashMap<java.lang.Integer,FormInstance> |
templateCache |
Constructor and Description |
---|
CachingInstanceTemplateManager() |
CachingInstanceTemplateManager(boolean restrictFormTypes) |
Modifier and Type | Method and Description |
---|---|
void |
addFormType(int formID)
Set a form type as allowed for caching.
|
void |
clearCache()
Remove all model templates from the cache.
|
FormInstance |
getTemplateInstance(int formID)
Return the template model for the given form type.
|
void |
resetFormTypes()
Empty the list of allowed form types
|
private java.util.HashMap<java.lang.Integer,FormInstance> templateCache
private java.util.ArrayList<java.lang.Integer> allowedFormTypes
private boolean restrictFormTypes
public CachingInstanceTemplateManager()
public CachingInstanceTemplateManager(boolean restrictFormTypes)
restrictFormTypes
- if true, only allowed form types will be cached; any requests for the templates
for other form types will throw an error; the list of allowed types starts out empty; register allowed
form types with addFormType(). if false, all form types will be handled and cachedpublic void clearCache()
public void addFormType(int formID)
formID
- public void resetFormTypes()
public FormInstance getTemplateInstance(int formID)
getTemplateInstance
in interface InstanceTemplateManager