Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   /*
    * Copyright 2014 Attila Szegedi, Daniel Dekany, Jonathan Revusky
    * 
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
    * 
    * http://www.apache.org/licenses/LICENSE-2.0
    * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  package freemarker.core;
  
  import java.io.Writer;
  import java.util.HashMap;
  import java.util.HashSet;
  import java.util.List;
  import java.util.Locale;
  import java.util.Map;
  import java.util.Set;
  
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.
  
  public class Configurable
  {
      static final String C_TRUE_FALSE = "true,false";
      
      private static final String DEFAULT = "default";
      private static final String DEFAULT_2_3_0 = "default_2_3_0";
      private static final String JVM_DEFAULT = "JVM default";
    
    
Legacy, snake case (like_this) variation of the setting name.

Since:
2.3.23
  
      public static final String LOCALE_KEY_SNAKE_CASE = "locale";
    
Modern, camel case (likeThis) variation of the setting name.

Since:
2.3.23
  
      public static final String LOCALE_KEY_CAMEL_CASE = "locale";
    
Alias to the ..._SNAKE_CASE variation due to backward compatibility constraints.
  
      public static final String LOCALE_KEY = ;
    
    
Legacy, snake case (like_this) variation of the setting name.

Since:
2.3.23
  
      public static final String NUMBER_FORMAT_KEY_SNAKE_CASE = "number_format";
    
Modern, camel case (likeThis) variation of the setting name.

Since:
2.3.23
  
      public static final String NUMBER_FORMAT_KEY_CAMEL_CASE = "numberFormat";
    
Alias to the ..._SNAKE_CASE variation due to backward compatibility constraints.
  
      public static final String NUMBER_FORMAT_KEY = ;
    
    
Legacy, snake case (like_this) variation of the setting name.

Since:
2.3.23
  
      public static final String TIME_FORMAT_KEY_SNAKE_CASE = "time_format";
    
Modern, camel case (likeThis) variation of the setting name.

Since:
2.3.23
  
      public static final String TIME_FORMAT_KEY_CAMEL_CASE = "timeFormat";
    
Alias to the ..._SNAKE_CASE variation due to backward compatibility constraints.
  
      public static final String TIME_FORMAT_KEY = ;
    
    
Legacy, snake case (like_this) variation of the setting name.

Since:
2.3.23
  
      public static final String DATE_FORMAT_KEY_SNAKE_CASE = "date_format";
    
Modern, camel case (likeThis) variation of the setting name.

Since:
2.3.23
  
      public static final String DATE_FORMAT_KEY_CAMEL_CASE = "dateFormat";
    
Alias to the ..._SNAKE_CASE variation due to backward compatibility constraints.
  
     public static final String DATE_FORMAT_KEY = ;
    
    
Legacy, snake case (like_this) variation of the setting name.

Since:
2.3.23
 
     public static final String DATETIME_FORMAT_KEY_SNAKE_CASE = "datetime_format";
    
Modern, camel case (likeThis) variation of the setting name.

Since:
2.3.23
 
     public static final String DATETIME_FORMAT_KEY_CAMEL_CASE = "datetimeFormat";
    
Alias to the ..._SNAKE_CASE variation due to backward compatibility constraints.
 
     public static final String DATETIME_FORMAT_KEY = ;
    
    
Legacy, snake case (like_this) variation of the setting name.

Since:
2.3.23
 
     public static final String TIME_ZONE_KEY_SNAKE_CASE = "time_zone";
    
Modern, camel case (likeThis) variation of the setting name.

Since:
2.3.23
 
     public static final String TIME_ZONE_KEY_CAMEL_CASE = "timeZone";
    
Alias to the ..._SNAKE_CASE variation due to backward compatibility constraints.
 
     public static final String TIME_ZONE_KEY = ;
    
    
Legacy, snake case (like_this) variation of the setting name.

Since:
2.3.23
 
     public static final String SQL_DATE_AND_TIME_TIME_ZONE_KEY_SNAKE_CASE = "sql_date_and_time_time_zone";
    
Modern, camel case (likeThis) variation of the setting name.

Since:
2.3.23
 
     public static final String SQL_DATE_AND_TIME_TIME_ZONE_KEY_CAMEL_CASE = "sqlDateAndTimeTimeZone";
    
Alias to the ..._SNAKE_CASE variation due to backward compatibility constraints.
 
     public static final String SQL_DATE_AND_TIME_TIME_ZONE_KEY = ;
    
    
Legacy, snake case (like_this) variation of the setting name.

Since:
2.3.23
 
     public static final String CLASSIC_COMPATIBLE_KEY_SNAKE_CASE = "classic_compatible";
    
Modern, camel case (likeThis) variation of the setting name.

Since:
2.3.23
 
     public static final String CLASSIC_COMPATIBLE_KEY_CAMEL_CASE = "classicCompatible";
    
Alias to the ..._SNAKE_CASE variation due to backward compatibility constraints.
 
     public static final String CLASSIC_COMPATIBLE_KEY = ;
    
    
Legacy, snake case (like_this) variation of the setting name.

Since:
2.3.23
 
     public static final String TEMPLATE_EXCEPTION_HANDLER_KEY_SNAKE_CASE = "template_exception_handler";
    
Modern, camel case (likeThis) variation of the setting name.

Since:
2.3.23
 
     public static final String TEMPLATE_EXCEPTION_HANDLER_KEY_CAMEL_CASE = "templateExceptionHandler";
    
Alias to the ..._SNAKE_CASE variation due to backward compatibility constraints.
 
     public static final String TEMPLATE_EXCEPTION_HANDLER_KEY = ;
    
    
Legacy, snake case (like_this) variation of the setting name.

Since:
2.3.23
 
     public static final String ARITHMETIC_ENGINE_KEY_SNAKE_CASE = "arithmetic_engine";
    
Modern, camel case (likeThis) variation of the setting name.

Since:
2.3.23
 
     public static final String ARITHMETIC_ENGINE_KEY_CAMEL_CASE = "arithmeticEngine";
    
Alias to the ..._SNAKE_CASE variation due to backward compatibility constraints.
 
     public static final String ARITHMETIC_ENGINE_KEY = ;
    
    
Legacy, snake case (like_this) variation of the setting name.

Since:
2.3.23
 
     public static final String OBJECT_WRAPPER_KEY_SNAKE_CASE = "object_wrapper";
    
Modern, camel case (likeThis) variation of the setting name.

Since:
2.3.23
 
     public static final String OBJECT_WRAPPER_KEY_CAMEL_CASE = "objectWrapper";
    
Alias to the ..._SNAKE_CASE variation due to backward compatibility constraints.
 
     public static final String OBJECT_WRAPPER_KEY = ;
    
    
Legacy, snake case (like_this) variation of the setting name.

Since:
2.3.23
 
     public static final String BOOLEAN_FORMAT_KEY_SNAKE_CASE = "boolean_format";
    
Modern, camel case (likeThis) variation of the setting name.

Since:
2.3.23
 
     public static final String BOOLEAN_FORMAT_KEY_CAMEL_CASE = "booleanFormat";
    
Alias to the ..._SNAKE_CASE variation due to backward compatibility constraints.
 
     public static final String BOOLEAN_FORMAT_KEY = ;
    
    
Legacy, snake case (like_this) variation of the setting name.

Since:
2.3.23
 
     public static final String OUTPUT_ENCODING_KEY_SNAKE_CASE = "output_encoding";
    
Modern, camel case (likeThis) variation of the setting name.

Since:
2.3.23
 
     public static final String OUTPUT_ENCODING_KEY_CAMEL_CASE = "outputEncoding";
    
Alias to the ..._SNAKE_CASE variation due to backward compatibility constraints.
 
     public static final String OUTPUT_ENCODING_KEY = ;
    
    
Legacy, snake case (like_this) variation of the setting name.

Since:
2.3.23
 
     public static final String URL_ESCAPING_CHARSET_KEY_SNAKE_CASE = "url_escaping_charset";
    
Modern, camel case (likeThis) variation of the setting name.

Since:
2.3.23
 
     public static final String URL_ESCAPING_CHARSET_KEY_CAMEL_CASE = "urlEscapingCharset";
    
Alias to the ..._SNAKE_CASE variation due to backward compatibility constraints.
 
     public static final String URL_ESCAPING_CHARSET_KEY = ;
    
    
Legacy, snake case (like_this) variation of the setting name.

Since:
2.3.23
 
     public static final String STRICT_BEAN_MODELS_KEY_SNAKE_CASE = "strict_bean_models";
    
Modern, camel case (likeThis) variation of the setting name.

Since:
2.3.23
 
     public static final String STRICT_BEAN_MODELS_KEY_CAMEL_CASE = "strictBeanModels";
    
Alias to the ..._SNAKE_CASE variation due to backward compatibility constraints.

Since:
2.3.22
 
     public static final String STRICT_BEAN_MODELS_KEY = ;
    
    
Legacy, snake case (like_this) variation of the setting name.

Since:
2.3.23
 
     public static final String AUTO_FLUSH_KEY_SNAKE_CASE = "auto_flush";
    
Modern, camel case (likeThis) variation of the setting name.

Since:
2.3.23
 
     public static final String AUTO_FLUSH_KEY_CAMEL_CASE = "autoFlush";
    
Alias to the ..._SNAKE_CASE variation due to backward compatibility constraints.

Since:
2.3.17
 
     public static final String AUTO_FLUSH_KEY = ;
    
    
Legacy, snake case (like_this) variation of the setting name.

Since:
2.3.23
 
     public static final String NEW_BUILTIN_CLASS_RESOLVER_KEY_SNAKE_CASE = "new_builtin_class_resolver";
    
Modern, camel case (likeThis) variation of the setting name.

Since:
2.3.23
 
     public static final String NEW_BUILTIN_CLASS_RESOLVER_KEY_CAMEL_CASE = "newBuiltinClassResolver";
    
Alias to the ..._SNAKE_CASE variation due to backward compatibility constraints.

Since:
2.3.17
 
     public static final String NEW_BUILTIN_CLASS_RESOLVER_KEY = ;
    
    
Legacy, snake case (like_this) variation of the setting name.

Since:
2.3.23
 
     public static final String SHOW_ERROR_TIPS_KEY_SNAKE_CASE = "show_error_tips";
    
Modern, camel case (likeThis) variation of the setting name.

Since:
2.3.23
 
     public static final String SHOW_ERROR_TIPS_KEY_CAMEL_CASE = "showErrorTips";
    
Alias to the ..._SNAKE_CASE variation due to backward compatibility constraints.

Since:
2.3.21
 
     public static final String SHOW_ERROR_TIPS_KEY = ;
    
    
Legacy, snake case (like_this) variation of the setting name.

Since:
2.3.23
 
     public static final String API_BUILTIN_ENABLED_KEY_SNAKE_CASE = "api_builtin_enabled";
    
Modern, camel case (likeThis) variation of the setting name.

Since:
2.3.23
 
     public static final String API_BUILTIN_ENABLED_KEY_CAMEL_CASE = "apiBuiltinEnabled";
    
Alias to the ..._SNAKE_CASE variation due to backward compatibility constraints.

Since:
2.3.22
 
     public static final String API_BUILTIN_ENABLED_KEY = ;
    
    
Legacy, snake case (like_this) variation of the setting name.

Since:
2.3.23
 
     public static final String LOG_TEMPLATE_EXCEPTIONS_KEY_SNAKE_CASE = "log_template_exceptions";
    
Modern, camel case (likeThis) variation of the setting name.

Since:
2.3.23
 
     public static final String LOG_TEMPLATE_EXCEPTIONS_KEY_CAMEL_CASE = "logTemplateExceptions";
    
Alias to the ..._SNAKE_CASE variation due to backward compatibility constraints.

Since:
2.3.22
 
     public static final String LOG_TEMPLATE_EXCEPTIONS_KEY = ;
    
    

Deprecated:
Use STRICT_BEAN_MODELS_KEY instead.
 
     public static final String STRICT_BEAN_MODELS = ;
     
     private static final String[] SETTING_NAMES_SNAKE_CASE = new String[] {
         // Must be sorted alphabetically!
         ,
         ,
         ,
         ,
     };
     
     private static final String[] SETTING_NAMES_CAMEL_CASE = new String[] {
         // Must be sorted alphabetically!
         ,
         ,
         ,
     };
 
     private Configurable parent;
     private Properties properties;
     private HashMap customAttributes;
     
     private Locale locale;
     private String numberFormat;
     private String timeFormat;
     private String dateFormat;
     private String dateTimeFormat;
     private TimeZone timeZone;
     private TimeZone sqlDataAndTimeTimeZone;
     private boolean sqlDataAndTimeTimeZoneSet;
     private String booleanFormat;
     private String trueStringValue;  // deduced from booleanFormat
     private String falseStringValue;  // deduced from booleanFormat
     private Integer classicCompatible;
     private ObjectWrapper objectWrapper;
     private String outputEncoding;
     private boolean outputEncodingSet;
     private String urlEscapingCharset;
     private boolean urlEscapingCharsetSet;
     private Boolean autoFlush;
     private Boolean showErrorTips;
     private Boolean apiBuiltinEnabled;
     private Boolean logTemplateExceptions;
    
    
Creates a top-level configurable, one that doesn't inherit from a parent, and thus stores the default values.

Deprecated:
This shouldn't even be public; don't use it.
 
     public Configurable() {
     }

    
Intended to be called from inside FreeMarker only. Creates a top-level configurable, one that doesn't inherit from a parent, and thus stores the default values. Called by the freemarker.template.Configuration constructor.
 
     protected Configurable(Version incompatibleImprovements) {
         _TemplateAPI.checkVersionNotNullAndSupported(incompatibleImprovements);
         
          = null;
          = new Properties();
         
          = Locale.getDefault();
         
          = TimeZone.getDefault();
         
          = null;
         
          = "number";
         
          = "";
         
          = "";
         
          = "";
         
          = new Integer(0);
         
                 incompatibleImprovements);
         
         
          = Configuration.getDefaultObjectWrapper(incompatibleImprovements);
         // bug: setProperty missing
         
          = .;
         
         
          = .;
         
          = .;
         
          = Boolean.valueOf(
                 _TemplateAPI.getDefaultLogTemplateExceptions(incompatibleImprovements));
         
         // outputEncoding and urlEscapingCharset defaults to null,
         // which means "not specified"
 
         setBooleanFormat();
         
          = new HashMap();
     }

    
Creates a new instance. Normally you do not need to use this constructor, as you don't use Configurable directly, but its subclasses.
 
     public Configurable(Configurable parent) {
         this. = parent;
          = null;
          = null;
          = null;
          = null;
          = new Properties(parent.properties);
          = new HashMap();
     }
     
     protected Object clone() throws CloneNotSupportedException {
         Configurable copy = (Configurable)super.clone();
         copy.properties = new Properties();
         copy.customAttributes = (HashMap).clone();
         return copy;
     }
    
    
Returns the parent Configurable object of this object. The parent stores the default setting values for this Configurable. For example, the parent of a freemarker.template.Template object is a freemarker.template.Configuration object, so values not specified on freemarker.template.Template-level are get from the freemarker.template.Configuration object.

Note on the parent of Environment: If you set incompatible_improvements to at least 2.3.22, it will be always the "main" freemarker.template.Template, that is, the template for whose processing the Environment was created. With lower incompatible_improvements, the current parent can temporary change during template execution, for example when your are inside an #include-d template (among others). Thus, don't build on which freemarker.template.Template the parent of Environment is during template execution, unless you set incompatible_improvements to 2.3.22 or higher.

Returns:
The parent Configurable object, or null if this is the root Configurable object (i.e, if it's the freemarker.template.Configuration object).
 
     public final Configurable getParent() {
         return ;
     }
    
    
Reparenting support. This is used by Environment when it includes a template - the included template becomes the parent configurable during its evaluation.
 
     final void setParent(Configurable parent) {
         this. = parent;
     }
    
    
Toggles the "Classic Compatible" mode. For a comprehensive description of this mode, see isClassicCompatible().
 
     public void setClassicCompatible(boolean classicCompatibility) {
         this. = new Integer(classicCompatibility ? 1 : 0);
     }

    
Same as setClassicCompatible(boolean), but allows some extra values.

Parameters:
classicCompatibility 0 means false, 1 means true, 2 means true but with emulating bugs in early 2.x classic-compatibility mode. Currently 2 affects how booleans are converted to string; with 1 it's always "true"/"", but with 2 it's "true"/"false" for values wrapped by freemarker.ext.beans.BeansWrapper as then java.lang.Boolean.toString() prevails. Note that someBoolean?string will always consistently format the boolean according the boolean_format setting, just like in FreeMarker 2.3 and later.
 
     public void setClassicCompatibleAsInt(int classicCompatibility) {
         if (classicCompatibility < 0 || classicCompatibility > 2) {
             throw new IllegalArgumentException("Unsupported \"classicCompatibility\": " + classicCompatibility);
         }
         this. = new Integer(classicCompatibility);
     }
     
         if (i == nullreturn null;
         else if (i.intValue() == 0) return .;
         else if (i.intValue() == 1) return .;
         else return i.toString();
     }
    
    
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:
    • in <assign varname=expr> directive, or in ${expr} directive, or in otherexpr == expr, or in otherexpr != expr, or in hash[expr], or in expr[keyOrIndex] (since 2.3.20), or in expr.key (since 2.3.20), then it's 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 on other places where a boolean expression is expected, it's 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. Except, if the value of the setting is 2, it will be formatted according the boolean_format setting, just like in 2.3.20 and later.
  • 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.
 
     public boolean isClassicCompatible() {
         return  != null ? .intValue() != 0 : .isClassicCompatible();
     }
 
     public int getClassicCompatibleAsInt() {
         return  != null ? .intValue() : .getClassicCompatibleAsInt();
     }
    
    
Sets the default locale used for number and date formatting (among others), also the locale used for searching localized template variations when no locale was explicitly requested.

 
     public void setLocale(Locale locale) {
         NullArgumentException.check("locale"locale);
         this. = locale;
         .setProperty(locale.toString());
     }

    
The getter pair of setTimeZone(java.util.TimeZone).
 
     public TimeZone getTimeZone() {
         return  != null ?  : .getTimeZone();
     }

    
Sets the time zone to use when formatting date/time values. Defaults to the system time zone (java.util.TimeZone.getDefault()), regardless of the "locale" FreeMarker setting, so in a server application you probably want to set it explicitly in the Environment to match the preferred time zone of target audience (like the Web page visitor).

If you or the templates set the time zone, you should probably also set setSQLDateAndTimeTimeZone(java.util.TimeZone)!

 
     public void setTimeZone(TimeZone timeZone) {
         NullArgumentException.check("timeZone"timeZone);
         this. = timeZone;
         .setProperty(timeZone.getID());
     }

    
Sets the time zone used when dealing with java.sql.Date and java.sql.Time values. It defaults to null for backward compatibility, but in most application this should be set to the JVM default time zone (server default time zone), because that's what most JDBC drivers will use when constructing the java.sql.Date and java.sql.Time values. If this setting is null, FreeMarker will use the value of (getTimeZone()) for java.sql.Date and java.sql.Time values, which often gives bad results.

This setting doesn't influence the formatting of other kind of values (like of java.sql.Timestamp or plain java.util.Date values).

To decide what value you need, a few things has to be understood:

  • Date-only and time-only values in SQL-oriented databases are usually store calendar and clock field values directly (year, month, day, or hour, minute, seconds (with decimals)), as opposed to a set of points on the physical time line. Thus, unlike SQL timestamps, these values usually aren't meant to be shown differently depending on the time zone of the audience.
  • When a JDBC query has to return a date-only or time-only value, it has to convert it to a point on the physical time line, because that's what java.util.Date and its subclasses store (milliseconds since the epoch). Obviously, this is impossible to do. So JDBC just chooses a physical time which, when rendered with the JVM default time zone, will give the same field values as those stored in the database. (Actually, you can give JDBC a calendar, and so it can use other time zones too, but most application won't care using those overloads.) For example, assume that the system time zone is GMT+02:00. Then, 2014-07-12 in the database will be translated to physical time 2014-07-11 22:00:00 UTC, because that rendered in GMT+02:00 gives 2014-07-12 00:00:00. Similarly, 11:57:00 in the database will be translated to physical time 1970-01-01 09:57:00 UTC. Thus, the physical time stored in the returned value depends on the default system time zone of the JDBC client, not just on the content in the database. (This used to be the default behavior of ORM-s, like Hibernate, too.)
  • The value of the time_zone FreeMarker configuration setting sets the time zone used for the template output. For example, when a web page visitor has a preferred time zone, the web application framework may calls Environment.setTimeZone(java.util.TimeZone) with that time zone. Thus, the visitor will see java.sql.Timestamp and plain java.util.Date values as they look in his own time zone. While this is desirable for those types, as they meant to represent physical points on the time line, this is not necessarily desirable for date-only and time-only values. When sql_date_and_time_time_zone is null, time_zone is used for rendering all kind of date/time/dateTime values, including java.sql.Date and java.sql.Time, and then if, for example, time_zone is GMT+00:00, the values from the earlier examples will be shown as 2014-07-11 (one day off) and 09:57:00 (2 hours off). While those are the time zone correct renderings, those values probably was meant to shown "as is".
  • You may wonder why this setting isn't simply "SQL time zone", since the time zone related behavior of JDBC applies to java.sql.Timestamp too. FreeMarker assumes that you have set up your application so that time stamps coming from the database go through the necessary conversion to store the correct distance from the epoch (1970-01-01 00:00:00 UTC), as requested by java.util.Date. In that case the time stamp can be safely rendered in different time zones, and thus it needs no special treatment.

Parameters:
tz Maybe null, in which case java.sql.Date and java.sql.Time values will be formatted in the time zone returned by getTimeZone(). (Note that since null is an allowed value for this setting, it will not cause getSQLDateAndTimeTimeZone() to fall back to the parent configuration.)
Since:
2.3.21
See also:
setTimeZone(java.util.TimeZone)
 
     public void setSQLDateAndTimeTimeZone(TimeZone tz) {
          = tz;
          = true;
         .setProperty(tz != null ? tz.getID() : "null");
     }
    
    
The getter pair of setSQLDateAndTimeTimeZone(java.util.TimeZone).

Returns:
null if the value of getTimeZone() should be used for formatting java.sql.Date and java.sql.Time values, otherwise the time zone that should be used to format the values of those two types.
Since:
2.3.21
 
     public TimeZone getSQLDateAndTimeTimeZone() {
         return 
                 ? 
                 : ( != null ? .getSQLDateAndTimeTimeZone() : null);
     }

    
Returns the assumed locale when searching for template files with no explicit requested locale. Defaults to system locale.
 
     public Locale getLocale() {
         return  != null ?  : .getLocale();
     }

    
Sets the default number format used to convert numbers to strings. Currently, this is either a java.text.DecimalFormat pattern (like "0.##"), or one of the following special values:

Defaults to "number".

 
     public void setNumberFormat(String numberFormat) {
         NullArgumentException.check("numberFormat"numberFormat);
         this. = numberFormat;
         .setProperty(numberFormat);
     }

    
 
     public String getNumberFormat() {
         return  != null ?  : .getNumberFormat();
     }

    
The string value for the boolean true and false values, intended for human audience (not for a computer language), separated with comma. For example, "yes,no". Note that white-space is significant, so "yes, no" is WRONG (unless you want that leading space before "no").

For backward compatibility the default is "true,false", but using that value is denied for automatic boolean-to-string conversion (like ${myBoolean} will fail with it), only myBool?string will allow it, which is deprecated since FreeMarker 2.3.20.

Note that automatic boolean-to-string conversion only exists since FreeMarker 2.3.20. Earlier this setting only influenced the result of myBool?string.

 
     public void setBooleanFormat(String booleanFormat) {
         NullArgumentException.check("booleanFormat"booleanFormat);
         
         int commaIdx = booleanFormat.indexOf(',');
         if(commaIdx == -1) {
             throw new IllegalArgumentException(
                     "Setting value must be string that contains two comma-separated values for true and false, " +
                     "respectively.");
         }
         
         this. = booleanFormat
         .setProperty(booleanFormat);
         
         if (booleanFormat.equals()) {
             // C_TRUE_FALSE is the default for BC, but it's not a good default for human audience formatting, so we
             // pretend that it wasn't set.
              = null
              = null;
         } else {
              = booleanFormat.substring(0, commaIdx); 
              = booleanFormat.substring(commaIdx + 1);
         }
     }
    
    
 
     public String getBooleanFormat() {
         return  != null ?  : .getBooleanFormat(); 
     }
     
     String formatBoolean(boolean valueboolean fallbackToTrueFalsethrows TemplateException {
         if (value) {
             String s = getTrueStringValue();
             if (s == null) {
                 if (fallbackToTrueFalse) {
                     return .;
                 } else {
                     throw new _MiscTemplateException(getNullBooleanFormatErrorDescription());
                 }
             } else {
                 return s;
             }
         } else {
             String s = getFalseStringValue();
             if (s == null) {
                 if (fallbackToTrueFalse) {
                     return .;
                 } else {
                     throw new _MiscTemplateException(getNullBooleanFormatErrorDescription());
                 }
             } else {
                 return s;
             }
         }
     }
 
         return new _ErrorDescriptionBuilder(new Object[] {
                 "Can't convert boolean to string automatically, because the \"" ,"\" setting was ",
                 new _DelayedJQuote(getBooleanFormat()), 
                 (getBooleanFormat().equals()
                     ? ", which is the legacy default computer-language format, and hence isn't accepted."
                     : ".") }).tips(new Object[] {
                  "If you just want \"true\"/\"false\" result as you are generting computer-language output, "
                  + "use \"?c\", like ${myBool?c}.",
                  "You can write myBool?string('yes', 'no') and like to specify boolean formatting in place.",
                  new Object[] {
                      "If you need the same two values on most places, the programmers should set the \"",
                       ,"\" setting to something like \"yes,no\"." }
                  });
     }

    
Returns the string to which true is converted to for human audience, or null if automatic coercion to string is not allowed. The default value is null.

This value is deduced from the "boolean_format" setting. Confusingly, for backward compatibility (at least until 2.4) that defaults to "true,false", yet this defaults to null. That's so because "true,false" is treated exceptionally, as that default is a historical mistake in FreeMarker, since it targets computer language output, not human writing. Thus it's ignored.

Since:
2.3.20
 
         // The first step deliberately tests booleanFormat instead of trueStringValue! 
         return  != null ?  : ( != null ? .getTrueStringValue() : null); 
     }

    
Same as getTrueStringValue() but with false.

Since:
2.3.20
 
         // The first step deliberately tests booleanFormat instead of falseStringValue! 
         return  != null ?  : ( != null ? .getFalseStringValue() : null); 
     }

    
Sets the format used to convert java.util.Date-s to string-s that are time (no date part) values, also the format that someString?time will use to parse strings.

For the possible values see setDateTimeFormat(java.lang.String).

Defaults to "", which means "use the FreeMarker default", which is currently "medium".

 
     public void setTimeFormat(String timeFormat) {
         NullArgumentException.check("timeFormat"timeFormat);
         this. = timeFormat;
         .setProperty(timeFormat);
     }

    
The getter pair of setTimeFormat(java.lang.String).
 
     public String getTimeFormat() {
         return  != null ?  : .getTimeFormat();
     }

    
Sets the format used to convert java.util.Date-s to string-s that are date (no time part) values, also the format that someString?date will use to parse strings.

For the possible values see setDateTimeFormat(java.lang.String).

Defaults to "", which means "use the FreeMarker default", which is currently "code".

 
     public void setDateFormat(String dateFormat) {
         NullArgumentException.check("dateFormat"dateFormat);
         this. = dateFormat;
         .setProperty(dateFormat);
     }

    
The getter pair of setDateFormat(java.lang.String).
 
     public String getDateFormat() {
         return  != null ?  : .getDateFormat();
     }

    
Sets the format used to convert java.util.Date-s to string-s that are date-time (timestamp) values, also the format that someString?datetime will use to parse strings.

The possible setting values are (the quotation marks aren't part of the value itself):

  • Patterns accepted by Java's java.text.SimpleDateFormat, for example "dd.MM.yyyy HH:mm:ss" (where HH means 24 hours format) or "MM/dd/yyyy hh:mm:ss a" (where a prints AM or PM, if the current language is English).

  • "xs" for XML Schema format, or "iso" for ISO 8601:2004 format. These formats allow various additional options, separated with space, like in "iso m nz" (or with _, like in "iso_m_nz"; this is useful in a case like lastModified?string.iso_m_nz). The options and their meanings are:

    • Accuracy options:
      ms = Milliseconds, always shown with all 3 digits, even if it's all 0-s. Example: 13:45:05.800
      s = Seconds (fraction seconds are dropped even if non-0), like 13:45:05
      m = Minutes, like 13:45. This isn't allowed for "xs".
      h = Hours, like 13. This isn't allowed for "xs".
      Neither = Up to millisecond accuracy, but trailing millisecond 0-s are removed, also the whole milliseconds part if it would be 0 otherwise. Example: 13:45:05.8

    • Time zone offset visibility options:
      fz = "Force Zone", always show time zone offset (even for for java.sql.Date and java.sql.Time values). But, because ISO 8601 doesn't allow for dates (means date without time of the day) to show the zone offset, this option will have no effect in the case of "iso" with dates.
      nz = "No Zone", never show time zone offset
      Neither = always show time zone offset, except for java.sql.Date and java.sql.Time, and for "iso" date values.

    • Time zone options:
      u = Use UTC instead of what the time_zone setting suggests. However, java.sql.Date and java.sql.Time aren't affected by this (see setSQLDateAndTimeTimeZone(java.util.TimeZone) to understand why)
      fu = "Force UTC", that is, use UTC instead of what the time_zone or the sql_date_and_time_time_zone setting suggests. This also effects java.sql.Date and java.sql.Time values
      Neither = Use the time zone suggested by the time_zone or the sql_date_and_time_time_zone configuration setting (setTimeZone(java.util.TimeZone) and setSQLDateAndTimeTimeZone(java.util.TimeZone)).

    The options can be specified in any order.

    Options from the same category are mutually exclusive, like using m and s together is an error.

    The accuracy and time zone offset visibility options don't influence parsing, only formatting. For example, even if you use "iso m nz", "2012-01-01T15:30:05.125+01" will be parsed successfully and with milliseconds accuracy. The time zone options (like "u") influence what time zone is chosen only when parsing a string that doesn't contain time zone offset.

    Parsing with "iso" understands both extend format and basic format, like 20141225T235018. It doesn't, however, support the parsing of all kind of ISO 8601 strings: if there's a date part, it must use year, month and day of the month values (not week of the year), and the day can't be omitted.

    The output of "iso" is deliberately so that it's also a good representation of the value with XML Schema format, except for 0 and negative years, where it's impossible. Also note that the time zone offset is omitted for date values in the "iso" format, while it's preserved for the "xs" format.

  • "short", "medium", "long", or "full", which that has locale-dependent meaning defined by the Java platform (see in the documentation of java.text.DateFormat). For date-time values, you can specify the length of the date and time part independently, be separating them with _, like "short_medium". ("medium" means "medium_medium" for date-time values.)

Defaults to "", which means "use the FreeMarker default", which is currently "code".

 
     public void setDateTimeFormat(String dateTimeFormat) {
         NullArgumentException.check("dateTimeFormat"dateTimeFormat);
         this. = dateTimeFormat;
         .setProperty(dateTimeFormat);
     }

    
 
     public String getDateTimeFormat() {
         return  != null ?  : .getDateTimeFormat();
     }

    
Sets the exception handler used to handle exceptions occurring inside templates. The default is freemarker.template.TemplateExceptionHandler.DEBUG_HANDLER. The recommended values are:

All of these will let the exception propagate further, so that you can catch it around freemarker.template.Template.process(java.lang.Object,java.io.Writer) for example. The difference is in what they print on the output before they do that.

Note that the freemarker.template.TemplateExceptionHandler is not meant to be used for generating HTTP error pages. Neither is it meant to be used to roll back the printed output. These should be solved outside template processing when the exception raises from Template.process. freemarker.template.TemplateExceptionHandler meant to be used if you want to include special content in the template output, or if you want to suppress certain exceptions.

 
     public void setTemplateExceptionHandler(TemplateExceptionHandler templateExceptionHandler) {
         NullArgumentException.check("templateExceptionHandler"templateExceptionHandler);
         this. = templateExceptionHandler;
         .setProperty(templateExceptionHandler.getClass().getName());
     }

    
 
         return  != null
                 ?  : .getTemplateExceptionHandler();
     }

    
Sets the arithmetic engine used to perform arithmetic operations. The default is ArithmeticEngine.BIGDECIMAL_ENGINE.
 
     public void setArithmeticEngine(ArithmeticEngine arithmeticEngine) {
         NullArgumentException.check("arithmeticEngine"arithmeticEngine);
         this. = arithmeticEngine;
         .setProperty(arithmeticEngine.getClass().getName());
     }

    
 
         return  != null
                 ?  : .getArithmeticEngine();
     }

    
Sets the object wrapper used to wrap objects to freemarker.template.TemplateModel-s. The default is freemarker.template.ObjectWrapper.DEFAULT_WRAPPER.
 
     public void setObjectWrapper(ObjectWrapper objectWrapper) {
         NullArgumentException.check("objectWrapper"objectWrapper);
         this. = objectWrapper;
         .setProperty(objectWrapper.getClass().getName());
     }

    
 
     public ObjectWrapper getObjectWrapper() {
         return  != null
                 ?  : .getObjectWrapper();
     }
    
    
Informs FreeMarker about the charset used for the output. As FreeMarker outputs character stream (not byte stream), it's not aware of the output charset unless the software that encloses it tells it with this setting. Some templates may use FreeMarker features that require this information. Setting this to null means that the output encoding is not known.

Defaults to null (unknown).

 
     public void setOutputEncoding(String outputEncoding) {
         this. = outputEncoding;
         // java.util.Properties doesn't allow null value!
         if (outputEncoding != null) {
             .setProperty(outputEncoding);
         } else {
             .remove();
         }
          = true;
     }
     
     public String getOutputEncoding() {
         return 
                ? 
                : ( != null ? .getOutputEncoding() : null);
    }
    
    
Sets the URL escaping charset. If not set (null), the output encoding (setOutputEncoding(java.lang.String)) will be used for URL escaping. Defaults to null.
    public void setURLEscapingCharset(String urlEscapingCharset) {
        this. = urlEscapingCharset;
        // java.util.Properties doesn't allow null value!
        if (urlEscapingCharset != null) {
            .setProperty(urlEscapingCharset);
        } else {
        }
         = true;
    }
    
    public String getURLEscapingCharset() {
        return 
                ? 
                : ( != null ? .getURLEscapingCharset() : null);
    }
    
    
Sets the TemplateClassResolver that is used when the new built-in is called in a template. That is, when a template contains the "com.example.SomeClassName"?new expression, this object will be called to resolve the "com.example.SomeClassName" string to a class. The default value is TemplateClassResolver.UNRESTRICTED_RESOLVER in FreeMarker 2.3.x, and TemplateClassResolver.SAFER_RESOLVER starting from FreeMarker 2.4.0. If you allow users to upload templates, it's important to use a custom restrictive TemplateClassResolver.

Since:
2.3.17
    public void setNewBuiltinClassResolver(TemplateClassResolver newBuiltinClassResolver) {
        NullArgumentException.check("newBuiltinClassResolver"newBuiltinClassResolver);
        this. = newBuiltinClassResolver;
                newBuiltinClassResolver.getClass().getName());
    }

    
Retrieves the TemplateClassResolver used to resolve classes when "SomeClassName"?new is called in a template.

Since:
2.3.17
        return  != null
                ?  : .getNewBuiltinClassResolver();
    }
    
    
Sets whether the output java.io.Writer is automatically flushed at the end of freemarker.template.Template.process(java.lang.Object,java.io.Writer) (and its overloads). The default is true.

Using false is needed for example when a Web page is composed from several boxes (like portlets, GUI panels, etc.) that aren't inserted with #include (or with similar directives) into a master FreeMarker template, rather they are all processed with a separate freemarker.template.Template.process(java.lang.Object,java.io.Writer) call. In a such scenario the automatic flushes would commit the HTTP response after each box, hence interfering with full-page buffering, and also possibly decreasing performance with too frequent and too early response buffer flushes.

Since:
2.3.17
    public void setAutoFlush(boolean autoFlush) {
        this. = Boolean.valueOf(autoFlush);
        .setProperty(, String.valueOf(autoFlush));
    }
    
    
See setAutoFlush(boolean)

Since:
2.3.17
    public boolean getAutoFlush() {
        return  != null 
            ? .booleanValue()
            : ( != null ? .getAutoFlush() : true);
    }
    
    
Sets if tips should be shown in error messages of errors arising during template processing. The default is true.

Since:
2.3.21
    public void setShowErrorTips(boolean showTips) {
        this. = Boolean.valueOf(showTips);
        .setProperty(, String.valueOf(showTips));
    }
    
    
See setShowErrorTips(boolean)

Since:
2.3.21
    public boolean getShowErrorTips() {
        return  != null 
            ? .booleanValue()
            : ( != null ? .getShowErrorTips() : true);
    }
    
    
Specifies if ?api can be used in templates. Defaults to false so that updating FreeMarker won't decrease the security of existing applications.

Since:
2.3.22
    public void setAPIBuiltinEnabled(boolean value) {
         = Boolean.valueOf(value);
        .setProperty(, String.valueOf(value));
    }

    
    public boolean isAPIBuiltinEnabled() {
        return  != null 
                ? .booleanValue()
                : ( != null ? .isAPIBuiltinEnabled() : false);
    }
    
    
Specifies if freemarker.template.TemplateException-s thrown by template processing are logged by FreeMarker or not. The default is true for backward compatibility, but that results in logging the exception twice in properly written applications, because there the freemarker.template.TemplateException thrown by the public FreeMarker API is also logged by the caller (even if only as the cause exception of a higher level exception). Hence, in modern applications it should be set to false. Note that this setting has no effect on the logging of exceptions caught by #attempt; those are always logged, no mater what (because those exceptions won't bubble up until the API caller).

Since:
2.3.22
    public void setLogTemplateExceptions(boolean value) {
         = Boolean.valueOf(value);
    }

    
    public boolean getLogTemplateExceptions() {
        return  != null 
                ? .booleanValue()
                : ( != null ? .getLogTemplateExceptions() : true);
    }
    
    private static final String ALLOWED_CLASSES = "allowed_classes";
    private static final String TRUSTED_TEMPLATES = "trusted_templates";
    
    
Sets a FreeMarker setting by a name and string value. If you can configure FreeMarker directly with Java (or other programming language), you should use the dedicated setter methods instead (like setObjectWrapper(freemarker.template.ObjectWrapper). This meant to be used if you get the settings from somewhere as text. Regardless, below you will find an overview of the settings available no matter how you set them.

Note: As of FreeMarker 2.3.23, setting names can be written in camel case too. For example, instead of date_format you can also use dateFormat. It's likely that camel case will become to the recommended convention in the future.

The list of settings commonly supported in all Configurable subclasses:

freemarker.template.Configuration (a subclass of Configurable) also understands these:

Regarding object builder expressions (used by the setting values where it was indicated):

  • Before FreeMarker 2.3.21 it had to be a fully qualified class name, and nothing else.

  • Since 2.3.21, the generic syntax is: className(constrArg1, constrArg2, ... constrArgN, propName1=propValue1, propName2=propValue2, ... propNameN=propValueN), where className is the fully qualified class name of the instance to create (except if we have builder class or INSTANCE field around, but see that later), constrArg-s are the values of constructor arguments, and propName=propValue-s set JavaBean properties (like x=1 means setX(1)) on the created instance. You can have any number of constructor arguments and property setters, including 0. Constructor arguments must precede any property setters.

  • Example: com.example.MyObjectWrapper(1, 2, exposeFields=true, cacheSize=5000) is nearly equivalent with this Java code: obj = new com.example.MyObjectWrapper(1, 2); obj.setExposeFields(true); obj.setCacheSize(5000);
  • If you have no constructor arguments and property setters, and the className class has a public static INSTANCE field, the value of that filed will be the value of the expression, and the constructor won't be called. Note that if you use the backward compatible syntax, where these's no parenthesis after the class name, then it will not look for INSTANCE.

  • If there exists a class named classNameBuilder, then that class will be instantiated instead with the given constructor arguments, and the JavaBean properties of that builder instance will be set. After that, the public build() method of the instance will be called, whose return value will be the value of the whole expression. (The builder class and the build() method is simply found by name, there's no special interface to implement.) Note that if you use the backward compatible syntax, where these's no parenthesis after the class name, then it will not look for builder class.

  • Currently, the values of arguments and properties can only be one of these:

    • A numerical literal, like 123 or -1.5. Like in FTL, there are no numerical types, the value will be automatically converted to the type of the target.
    • A boolean literal: true or false
    • The null literal: null
    • A string literal with FTL syntax, except that it can't contain ${...}-s and #{...}-s. Examples: "Line 1\nLine 2" or r"C:\temp".
    • An object builder expression. That is, object builder expressions can be nested into each other.
  • The top-level object builder expressions may omit (). In that case, for backward compatibility, the INSTANCE field and the builder class is not searched, so the instance will be always created with its parameterless constructor. (This behavior will possibly change in 2.4.) The () can't be omitted for nested expressions.

  • The classes and methods that the expression meant to access must be all public.

Parameters:
name the name of the setting.
value the string that describes the new value of the setting.
Throws:
Configurable.UnknownSettingException if the name is wrong.
freemarker.template.TemplateException if the new value of the setting can't be set for any other reasons.
    public void setSetting(String nameString valuethrows TemplateException {
        boolean unknown = false;
        try {
            if (.equals(name)) {
                setLocale(StringUtil.deduceLocale(value));
            } else if (.equals(name) || .equals(name)) {
                setNumberFormat(value);
            } else if (.equals(name) || .equals(name)) {
                setTimeFormat(value);
            } else if (.equals(name) || .equals(name)) {
                setDateFormat(value);
            } else if (.equals(name) || .equals(name)) {
                setDateTimeFormat(value);
            } else if (.equals(name) || .equals(name)) {
                setTimeZone(parseTimeZoneSettingValue(value));
            } else if (.equals(name)
                    || .equals(name)) {
                setSQLDateAndTimeTimeZone(value.equals("null") ? null : parseTimeZoneSettingValue(value));
            } else if (.equals(name)
                    || .equals(name)) {
                char firstChar;
                if (value != null && value.length() > 0) {
                    firstChar =  value.charAt(0);
                } else {
                    firstChar = 0;
                }
                if (Character.isDigit(firstChar) || firstChar == '+' || firstChar == '-') {
                    setClassicCompatibleAsInt(Integer.parseInt(value));
                } else {
                    setClassicCompatible(value != null ? StringUtil.getYesNo(value) : false);
                }
            } else if (.equals(name)
                    || .equals(name)) {
                if (value.indexOf('.') == -1) {
                    if ("debug".equalsIgnoreCase(value)) {
                        setTemplateExceptionHandler(
                                .);
                    } else if ("html_debug".equalsIgnoreCase(value) || "htmlDebug".equals(value)) {
                        setTemplateExceptionHandler(
                                .);
                    } else if ("ignore".equalsIgnoreCase(value)) {
                        setTemplateExceptionHandler(
                                .);
                    } else if ("rethrow".equalsIgnoreCase(value)) {
                        setTemplateExceptionHandler(
                                .);
                    } else if (.equalsIgnoreCase(value) && this instanceof Configuration) {
                        ((Configurationthis).unsetTemplateExceptionHandler();
                    } else {
                        throw invalidSettingValueException(namevalue);
                    }
                } else {
                    setTemplateExceptionHandler((TemplateExceptionHandler) _ObjectBuilderSettingEvaluator.eval(
                            valueTemplateExceptionHandler.class, _SettingEvaluationEnvironment.getCurrent()));
                }
            } else if (.equals(name) || .equals(name)) {
                if (value.indexOf('.') == -1) { 
                    if ("bigdecimal".equalsIgnoreCase(value)) {
                        setArithmeticEngine(.);
                    } else if ("conservative".equalsIgnoreCase(value)) {
                        setArithmeticEngine(.);
                    } else {
                        throw invalidSettingValueException(namevalue);
                    }
                } else {
                    setArithmeticEngine((ArithmeticEngine) _ObjectBuilderSettingEvaluator.eval(
                            valueArithmeticEngine.class, _SettingEvaluationEnvironment.getCurrent()));
                }
            } else if (.equals(name) || .equals(name)) {
                if (.equalsIgnoreCase(value)) {
                    if (this instanceof Configuration) {
                        ((Configurationthis).unsetObjectWrapper();
                    } else {
                        setObjectWrapper(Configuration.getDefaultObjectWrapper(.));
                    }
                } else if (.equalsIgnoreCase(value)) {
                    setObjectWrapper(Configuration.getDefaultObjectWrapper(.));
                } else if ("simple".equalsIgnoreCase(value)) {
                    setObjectWrapper(.);
                } else if ("beans".equalsIgnoreCase(value)) {
                    setObjectWrapper(.);
                } else if ("jython".equalsIgnoreCase(value)) {
                    Class clazz = Class.forName(
                            "freemarker.ext.jython.JythonWrapper");
                    setObjectWrapper(
                            (ObjectWrapperclazz.getField("INSTANCE").get(null));        
                } else {
                    setObjectWrapper((ObjectWrapper) _ObjectBuilderSettingEvaluator.eval(
                                    valueObjectWrapper.class, _SettingEvaluationEnvironment.getCurrent()));
                }
            } else if (.equals(name) || .equals(name)) {
                setBooleanFormat(value);
            } else if (.equals(name) || .equals(name)) {
                setOutputEncoding(value);
            } else if (.equals(name)
                    || .equals(name)) {
                setURLEscapingCharset(value);
            } else if (.equals(name)
                    || .equals(name)) {
                setStrictBeanModels(StringUtil.getYesNo(value));
            } else if (.equals(name) || .equals(name)) {
                setAutoFlush(StringUtil.getYesNo(value));
            } else if (.equals(name) || .equals(name)) {
                setShowErrorTips(StringUtil.getYesNo(value));
            } else if (.equals(name)
                    || .equals(name)) {
                setAPIBuiltinEnabled(StringUtil.getYesNo(value));
            } else if (.equals(name)
                    || .equals(name)) {
                if ("unrestricted".equals(value)) {
                } else if ("safer".equals(value)) {
                    setNewBuiltinClassResolver(.);
                } else if ("allows_nothing".equals(value) || "allowsNothing".equals(value)) {
                } else if (value.indexOf(":") != -1) {
                    List segments = parseAsSegmentedList(value);
                    Set allowedClasses = null;
                    List trustedTemplates = null;
                    for (int i = 0; i < segments.size(); i++) {
                        KeyValuePair kv = (KeyValuePairsegments.get(i);
                        String segmentKey = (Stringkv.getKey();
                        List segmentValue = (Listkv.getValue();
                        if (segmentKey.equals()) {
                            allowedClasses = new HashSet(segmentValue); 
                        } else if (segmentKey.equals()) {
                            trustedTemplates = segmentValue;
                        } else {
                            throw new ParseException(
                                    "Unrecognized list segment key: " + StringUtil.jQuote(segmentKey) +
                                    ". Supported keys are: \"" +  + "\", \"" +
                                     + "\"", 0, 0);
                        }
                    }
                    setNewBuiltinClassResolver(
                            new OptInTemplateClassResolver(allowedClassestrustedTemplates));
                } else if (value.indexOf('.') != -1) {
                    setNewBuiltinClassResolver((TemplateClassResolver) _ObjectBuilderSettingEvaluator.eval(
                                    valueTemplateClassResolver.class, _SettingEvaluationEnvironment.getCurrent()));
                } else {
                    throw invalidSettingValueException(namevalue);
                }
            } else if (.equals(name)
                    || .equals(name)) {
                setLogTemplateExceptions(StringUtil.getYesNo(value));
            } else {
                unknown = true;
            }
        } catch(Exception e) {
            throw settingValueAssignmentException(namevaluee);
        }
        if (unknown) {
            throw unknownSettingException(name);
        }
    }
    
    
Returns the possible setting names.
    // [Java 5] Add type param. [FM 2.4] Add public parameterless version the returns the camelCase names.
    Set/*<String>*/ getSettingNames(boolean camelCase) {
        return new _SortedArraySet(camelCase ?  : ); 
    }
    private TimeZone parseTimeZoneSettingValue(String value) {
        TimeZone tz;
        if (.equalsIgnoreCase(value)) {
            tz = TimeZone.getDefault();
        } else {
            tz = TimeZone.getTimeZone(value);
        }
        return tz;
    }
    public void setStrictBeanModels(boolean strict) {
	if (!( instanceof BeansWrapper)) {
	    throw new IllegalStateException("The value of the " +  +
	            " setting isn't a " + BeansWrapper.class.getName() + ".");
    }
    
    
Returns the textual representation of a setting.

Deprecated:
It's not possible in general to convert setting values to string, and thus it's impossible to ensure that setSetting(java.lang.String,java.lang.String) will work with the returned value correctly.
Parameters:
key the setting key. Can be any of standard XXX_KEY constants, or a custom key.
    public String getSetting(String key) {
        return .getProperty(key);
    }
    
    
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).

Deprecated:
This method was always defective, and certainly it always will be. Don't use it. (Simply, it's hardly possible in general to convert setting values to text in a way that ensures that setSettings(java.util.Properties) will work with them correctly.)
    public Map getSettings() {
        return Collections.unmodifiableMap();
    }
    
    protected Environment getEnvironment() {
        return this instanceof Environment
            ? (Environmentthis
            : Environment.getCurrentEnvironment();
    }
    
    
Creates the exception that should be thrown when a setting name isn't recognized.
        return new UnknownSettingException(
                getEnvironment(), namegetCorrectedNameForUnknownSetting(name));
    }

    

Parameters:
name The wrong name
Returns:
The corrected name, or null if there's no known correction
Since:
2.3.21