Class CustomAttribute

java.lang.Object
freemarker.core.CustomAttribute

public class CustomAttribute extends Object
A class that allows one to associate custom data with a Configuration, a Template, or Environment.

This API has similar approach to that of ThreadLocal (which allows one to associate custom data with a thread). With an example:

 // The object identity itself will serve as the attribute identifier; there's no attribute name String:
 public static final CustomAttribute MY_ATTR = new CustomAttribute(CustomAttribute.SCOPE_CONFIGURATION);
 ...
     // Set the attribute in this particular Configuration object:
     MY_ATTR.set(myAttrValue, cfg);
     ...
     // Read the attribute from this particular Configuration object:
     myAttrValue = MY_ATTR.get(cfg);