Java Doc for Configurable.java in  » Template-Engine » freemarker-2.3.10 » freemarker » core » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Template Engine » freemarker 2.3.10 » freemarker.core 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   freemarker.core.Configurable

All known Subclasses:   freemarker.template.Configuration,  freemarker.template.Template,  freemarker.core.Environment,
Configurable
public class Configurable (Code)
This is a common superclass of freemarker.template.Configuration , freemarker.template.Template , and Environment classes. It provides settings that are common to each of them. FreeMarker uses a three-level setting hierarchy - the return value of every setting getter method on Configurable objects inherits its value from its parent Configurable object, unless explicitly overridden by a call to a corresponding setter method on the object itself. The parent of an Environment object is a Template object, the parent of a Template object is a Configuration object.
version:
   $Id: Configurable.java,v 1.23.2.2 2007/04/02 13:46:43 szegedia Exp $
author:
   Attila Szegedi

Inner Class :public class UnknownSettingException extends TemplateException

Field Summary
final public static  StringARITHMETIC_ENGINE_KEY
    
final public static  StringBOOLEAN_FORMAT_KEY
    
final public static  StringCLASSIC_COMPATIBLE_KEY
    
final public static  StringDATETIME_FORMAT_KEY
    
final public static  StringDATE_FORMAT_KEY
    
final public static  StringLOCALE_KEY
    
final public static  StringNUMBER_FORMAT_KEY
    
final public static  StringOBJECT_WRAPPER_KEY
    
final public static  StringOUTPUT_ENCODING_KEY
    
final public static  StringSTRICT_BEAN_MODELS
    
final public static  StringTEMPLATE_EXCEPTION_HANDLER_KEY
    
final public static  StringTIME_FORMAT_KEY
    
final public static  StringTIME_ZONE_KEY
    
final public static  StringURL_ESCAPING_CHARSET_KEY
    

Constructor Summary
public  Configurable()
    
public  Configurable(Configurable parent)
     Creates a new instance.

Method Summary
protected  Objectclone()
    
public  ArithmeticEnginegetArithmeticEngine()
     Retrieves the arithmetic engine used to perform arithmetic operations.
public  StringgetBooleanFormat()
    
 StringgetBooleanFormat(boolean value)
    
 ObjectgetCustomAttribute(Object key, CustomAttribute attr)
    
public  ObjectgetCustomAttribute(String name)
     Retrieves a named custom attribute for this configurable.
public  String[]getCustomAttributeNames()
     Returns an array with names of all custom attributes defined directly on this configurable.
public  StringgetDateFormat()
     Returns the date format used to convert date models representing date-only dates to strings.
public  StringgetDateTimeFormat()
     Returns the date format used to convert date models representing datetime dates to strings.
protected  EnvironmentgetEnvironment()
    
public  LocalegetLocale()
     Returns the assumed locale when searching for template files with no explicit requested locale.
public  StringgetNumberFormat()
     Returns the default number format used to convert numbers to strings.
public  ObjectWrappergetObjectWrapper()
     Retrieves the object wrapper used to wrap objects to template models.
public  StringgetOutputEncoding()
    
final public  ConfigurablegetParent()
     Returns the parent Configurable object of this object. The parent stores the default values for this configurable.
public  StringgetSetting(String key)
     Returns the textual representation of a setting.
Parameters:
  key - the setting key.
public  MapgetSettings()
     This meant to return the String-to-String Map of the settings.
public  TemplateExceptionHandlergetTemplateExceptionHandler()
     Retrieves the exception handler used to handle template exceptions.
public  StringgetTimeFormat()
     Returns the date format used to convert date models representing time-only dates to strings.
public  TimeZonegetTimeZone()
     Returns the time zone to use when formatting time values.
public  StringgetURLEscapingCharset()
    
protected  TemplateExceptioninvalidSettingValueException(String name, String value)
    
public  booleanisClassicCompatible()
     Returns whether the engine runs in the "Classic Compatibile" mode. When this mode is active, the engine behavior is altered in following way: (these resemble the behavior of the 1.7.x line of FreeMarker engine, now named "FreeMarker Classic", hence the name).
  • handle undefined expressions gracefully.
public  voidremoveCustomAttribute(String name)
     Removes a named custom attribute for this configurable.
public  voidsetArithmeticEngine(ArithmeticEngine arithmeticEngine)
     Sets the arithmetic engine used to perform arithmetic operations.
public  voidsetBooleanFormat(String booleanFormat)
    
public  voidsetClassicCompatible(boolean classicCompatibility)
     Toggles the "Classic Compatibile" mode.
 voidsetCustomAttribute(Object key, Object value)
    
public  voidsetCustomAttribute(String name, Object value)
     Sets a named custom attribute for this configurable.
Parameters:
  name - the name of the custom attribute
Parameters:
  value - the value of the custom attribute.
public  voidsetDateFormat(String dateFormat)
     Sets the date format used to convert date models representing date-only dates to strings.
public  voidsetDateTimeFormat(String dateTimeFormat)
     Sets the date format used to convert date models representing datetime dates to strings.
public  voidsetLocale(Locale locale)
     Sets the locale to assume when searching for template files with no explicit requested locale.
public  voidsetNumberFormat(String numberFormat)
     Sets the number format used to convert numbers to strings.
public  voidsetObjectWrapper(ObjectWrapper objectWrapper)
     Sets the object wrapper used to wrap objects to template models.
public  voidsetOutputEncoding(String outputEncoding)
     Sets the output encoding.
final  voidsetParent(Configurable parent)
     Reparenting support.
public  voidsetSetting(String key, String value)
     Sets a setting by a name and string value.

List of supported names and their valid values:

  • "locale": local codes with the usual format, such as "en_US".
  • "classic_compatible": "true", "false", "yes", "no", "t", "f", "y", "n". Case insensitive.
  • "template_exception_handler": If the value contains dot, then it is interpreted as class name, and the object will be created with its parameterless constructor.
public  voidsetSettings(Properties props)
     Set the settings stored in a Properties object.
public  voidsetSettings(InputStream propsIn)
     Reads a setting list (key and element pairs) from the input stream.
public  voidsetStrictBeanModels(boolean strict)
    
public  voidsetTemplateExceptionHandler(TemplateExceptionHandler templateExceptionHandler)
     Sets the exception handler used to handle template exceptions.
public  voidsetTimeFormat(String timeFormat)
     Sets the date format used to convert date models representing time-only values to strings.
public  voidsetTimeZone(TimeZone timeZone)
     Sets the time zone to use when formatting time values.
public  voidsetURLEscapingCharset(String urlEscapingCharset)
     Sets the URL escaping charset.
protected  TemplateExceptionunknownSettingException(String name)
    

Field Detail
ARITHMETIC_ENGINE_KEY
final public static String ARITHMETIC_ENGINE_KEY(Code)



BOOLEAN_FORMAT_KEY
final public static String BOOLEAN_FORMAT_KEY(Code)



CLASSIC_COMPATIBLE_KEY
final public static String CLASSIC_COMPATIBLE_KEY(Code)



DATETIME_FORMAT_KEY
final public static String DATETIME_FORMAT_KEY(Code)



DATE_FORMAT_KEY
final public static String DATE_FORMAT_KEY(Code)



LOCALE_KEY
final public static String LOCALE_KEY(Code)



NUMBER_FORMAT_KEY
final public static String NUMBER_FORMAT_KEY(Code)



OBJECT_WRAPPER_KEY
final public static String OBJECT_WRAPPER_KEY(Code)



OUTPUT_ENCODING_KEY
final public static String OUTPUT_ENCODING_KEY(Code)



STRICT_BEAN_MODELS
final public static String STRICT_BEAN_MODELS(Code)



TEMPLATE_EXCEPTION_HANDLER_KEY
final public static String TEMPLATE_EXCEPTION_HANDLER_KEY(Code)



TIME_FORMAT_KEY
final public static String TIME_FORMAT_KEY(Code)



TIME_ZONE_KEY
final public static String TIME_ZONE_KEY(Code)



URL_ESCAPING_CHARSET_KEY
final public static String URL_ESCAPING_CHARSET_KEY(Code)




Constructor Detail
Configurable
public Configurable()(Code)



Configurable
public Configurable(Configurable parent)(Code)
Creates a new instance. Normally you do not need to use this constructor, as you don't use Configurable directly, but its subclasses.




Method Detail
clone
protected Object clone() throws CloneNotSupportedException(Code)



getArithmeticEngine
public ArithmeticEngine getArithmeticEngine()(Code)
Retrieves the arithmetic engine used to perform arithmetic operations.



getBooleanFormat
public String getBooleanFormat()(Code)



getBooleanFormat
String getBooleanFormat(boolean value)(Code)



getCustomAttribute
Object getCustomAttribute(Object key, CustomAttribute attr)(Code)
Internal entry point for getting unnamed custom attributes



getCustomAttribute
public Object getCustomAttribute(String name)(Code)
Retrieves a named custom attribute for this configurable. If the attribute is not present in the configurable, and the configurable has a parent, then the parent is looked up as well.
Parameters:
  name - the name of the custom attribute the value of the custom attribute. Note that if the custom attributewas created with <#ftl attributes={...}>, then this value is alreadyunwrapped (i.e. it's a String, or a List, or aMap, ...etc., not a FreeMarker specific class).



getCustomAttributeNames
public String[] getCustomAttributeNames()(Code)
Returns an array with names of all custom attributes defined directly on this configurable. (That is, it doesn't contain the names of custom attributes defined indirectly on its parent configurables.) The returned array is never null, but can be zero-length. The order of elements in the returned array is not defined and can change between invocations.



getDateFormat
public String getDateFormat()(Code)
Returns the date format used to convert date models representing date-only dates to strings. Defaults to "date"



getDateTimeFormat
public String getDateTimeFormat()(Code)
Returns the date format used to convert date models representing datetime dates to strings. Defaults to "datetime"



getEnvironment
protected Environment getEnvironment()(Code)



getLocale
public Locale getLocale()(Code)
Returns the assumed locale when searching for template files with no explicit requested locale. Defaults to system locale.



getNumberFormat
public String getNumberFormat()(Code)
Returns the default number format used to convert numbers to strings. Defaults to "number"



getObjectWrapper
public ObjectWrapper getObjectWrapper()(Code)
Retrieves the object wrapper used to wrap objects to template models.



getOutputEncoding
public String getOutputEncoding()(Code)



getParent
final public Configurable getParent()(Code)
Returns the parent Configurable object of this object. The parent stores the default values for this configurable. For example, the parent of the freemarker.template.Template object is the freemarker.template.Configuration object, so setting values not specfied on template level are specified by the confuration object. the parent Configurable object, or null, if this isthe root Configurable object.



getSetting
public String getSetting(String key)(Code)
Returns the textual representation of a setting.
Parameters:
  key - the setting key. Can be any of standard XXX_KEYconstants, or a custom key.Configurable.setSetting(String,String)



getSettings
public Map getSettings()(Code)
This meant to return the String-to-String Map of the settings. So it actually should return a Properties object, but it doesn't by mistake. The returned Map is read-only, but it will reflect the further configuration changes (aliasing effect). Configurable.setSettings(Properties)



getTemplateExceptionHandler
public TemplateExceptionHandler getTemplateExceptionHandler()(Code)
Retrieves the exception handler used to handle template exceptions.



getTimeFormat
public String getTimeFormat()(Code)
Returns the date format used to convert date models representing time-only dates to strings. Defaults to "time"



getTimeZone
public TimeZone getTimeZone()(Code)
Returns the time zone to use when formatting time values. Defaults to system time zone.



getURLEscapingCharset
public String getURLEscapingCharset()(Code)



invalidSettingValueException
protected TemplateException invalidSettingValueException(String name, String value)(Code)



isClassicCompatible
public boolean isClassicCompatible()(Code)
Returns whether the engine runs in the "Classic Compatibile" mode. When this mode is active, the engine behavior is altered in following way: (these resemble the behavior of the 1.7.x line of FreeMarker engine, now named "FreeMarker Classic", hence the name).
  • handle undefined expressions gracefully. Namely when an expression "expr" evaluates to null:
    • as argument of the <assign varname=expr> directive, ${expr} directive, otherexpr == expr or otherexpr != expr conditional expressions, or hash[expr] expression, then it is treated as empty string.
    • as argument of <list expr as item> or <foreach item in expr>, the loop body is not executed (as if it were a 0-length list)
    • as argument of <if> directive, or otherwise where a boolean expression is expected, it is treated as false
  • Non-boolean models are accepted in <if> directive, or as operands of logical operators. "Empty" models (zero-length string, empty sequence or hash) are evaluated as false, all others are evaluated as true.
  • When boolean value is treated as a string (i.e. output in ${...} directive, or concatenated with other string), true values are converted to string "true", false values are converted to empty string.
  • Scalar models supplied to <list> and <foreach> are treated as a one-element list consisting of the passed model.
  • Paths parameter of <include> will be interpreted as absolute path.
In all other aspects, the engine is a 2.1 engine even in compatibility mode - you don't lose any of the new functionality by enabling it.



removeCustomAttribute
public void removeCustomAttribute(String name)(Code)
Removes a named custom attribute for this configurable. Note that this is different than setting the custom attribute value to null. If you set the value to null, Configurable.getCustomAttribute(String) will return null, while if you remove the attribute, it will return the value of the attribute in the parent configurable (if there is a parent configurable, that is).
Parameters:
  name - the name of the custom attribute



setArithmeticEngine
public void setArithmeticEngine(ArithmeticEngine arithmeticEngine)(Code)
Sets the arithmetic engine used to perform arithmetic operations.
Parameters:
  arithmeticEngine - the arithmetic engine used to perform arithmeticoperations.By default, ArithmeticEngine.BIGDECIMAL_ENGINE is used.



setBooleanFormat
public void setBooleanFormat(String booleanFormat)(Code)



setClassicCompatible
public void setClassicCompatible(boolean classicCompatibility)(Code)
Toggles the "Classic Compatibile" mode. For a comprehensive description of this mode, see Configurable.isClassicCompatible() .



setCustomAttribute
void setCustomAttribute(Object key, Object value)(Code)
Internal entry point for setting unnamed custom attributes



setCustomAttribute
public void setCustomAttribute(String name, Object value)(Code)
Sets a named custom attribute for this configurable.
Parameters:
  name - the name of the custom attribute
Parameters:
  value - the value of the custom attribute. You can set the value tonull, however note that there is a semantic difference between anattribute set to null and an attribute that is not present, seeConfigurable.removeCustomAttribute(String).



setDateFormat
public void setDateFormat(String dateFormat)(Code)
Sets the date format used to convert date models representing date-only dates to strings.



setDateTimeFormat
public void setDateTimeFormat(String dateTimeFormat)(Code)
Sets the date format used to convert date models representing datetime dates to strings.



setLocale
public void setLocale(Locale locale)(Code)
Sets the locale to assume when searching for template files with no explicit requested locale.



setNumberFormat
public void setNumberFormat(String numberFormat)(Code)
Sets the number format used to convert numbers to strings.



setObjectWrapper
public void setObjectWrapper(ObjectWrapper objectWrapper)(Code)
Sets the object wrapper used to wrap objects to template models.
Parameters:
  objectWrapper - the object wrapper used to wrap objects to templatemodels.By default, ObjectWrapper.DEFAULT_WRAPPER is used.



setOutputEncoding
public void setOutputEncoding(String outputEncoding)(Code)
Sets the output encoding. Allows null, which means that the output encoding is not known.



setParent
final void setParent(Configurable parent)(Code)
Reparenting support. This is used by Environment when it includes a template - the included template becomes the parent configurable during its evaluation.



setSetting
public void setSetting(String key, String value) throws TemplateException(Code)
Sets a setting by a name and string value.

List of supported names and their valid values:

  • "locale": local codes with the usual format, such as "en_US".
  • "classic_compatible": "true", "false", "yes", "no", "t", "f", "y", "n". Case insensitive.
  • "template_exception_handler": If the value contains dot, then it is interpreted as class name, and the object will be created with its parameterless constructor. If the value does not contain dot, then it must be one of these special values: "rethrow", "debug", "html_debug", "ignore" (case insensitive).
  • "arithmetic_engine": If the value contains dot, then it is interpreted as class name, and the object will be created with its parameterless constructor. If the value does not contain dot, then it must be one of these special values: "bigdecimal", "conservative" (case insensitive).
  • "object_wrapper": If the value contains dot, then it is interpreted as class name, and the object will be created with its parameterless constructor. If the value does not contain dot, then it must be one of these special values: "simple", "beans", "jython" (case insensitive).
  • "number_format": pattern as java.text.DecimalFormat defines.
  • "boolean_format": the textual value for boolean true and false, separated with comma. For example "yes,no".
  • "date_format", "time_format", "datetime_format": patterns as java.text.SimpleDateFormat defines.
  • "time_zone": time zone, with the format as java.util.TimeZone.getTimeZone defines. For example "GMT-8:00" or "America/Los_Angeles"
  • "output_encoding": Informs FreeMarker about the charset used for the output. As FreeMarker outputs character stream (not byte stream), it is not aware of the output charset unless the software that encloses it tells it explicitly with this setting. Some templates may use FreeMarker features that require this.
  • "url_escaping_charset": If this setting is set, then it overrides the value of the "output_encoding" setting when FreeMarker does URL encoding.

Parameters:
  key - the name of the setting.
Parameters:
  value - the string that describes the new value of the setting.
throws:
  UnknownSettingException - if the key is wrong.
throws:
  TemplateException - if the new value of the setting can't be setfor any other reasons.



setSettings
public void setSettings(Properties props) throws TemplateException(Code)
Set the settings stored in a Properties object.
throws:
  TemplateException - if the Properties object containsinvalid keys, or invalid setting values, or any other error occurswhile changing the settings.



setSettings
public void setSettings(InputStream propsIn) throws TemplateException, IOException(Code)
Reads a setting list (key and element pairs) from the input stream. The stream has to follow the usual .properties format.
throws:
  TemplateException - if the stream containsinvalid keys, or invalid setting values, or any other error occurswhile changing the settings.
throws:
  IOException - if an error occurred when reading from the input stream.



setStrictBeanModels
public void setStrictBeanModels(boolean strict)(Code)



setTemplateExceptionHandler
public void setTemplateExceptionHandler(TemplateExceptionHandler templateExceptionHandler)(Code)
Sets the exception handler used to handle template exceptions.
Parameters:
  templateExceptionHandler - the template exception handler to use for handling TemplateExceptions. By default, TemplateExceptionHandler.HTML_DEBUG_HANDLER is used.



setTimeFormat
public void setTimeFormat(String timeFormat)(Code)
Sets the date format used to convert date models representing time-only values to strings.



setTimeZone
public void setTimeZone(TimeZone timeZone)(Code)
Sets the time zone to use when formatting time values.



setURLEscapingCharset
public void setURLEscapingCharset(String urlEscapingCharset)(Code)
Sets the URL escaping charset. Allows null, which means that the output encoding will be used for URL escaping.



unknownSettingException
protected TemplateException unknownSettingException(String name)(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.