Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 77DF7200B26 for ; Sun, 12 Jun 2016 18:53:51 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 76ADC160A5D; Sun, 12 Jun 2016 16:53:51 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 2C6C7160A6A for ; Sun, 12 Jun 2016 18:53:50 +0200 (CEST) Received: (qmail 99222 invoked by uid 500); 12 Jun 2016 16:53:49 -0000 Mailing-List: contact notifications-help@freemarker.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@freemarker.incubator.apache.org Delivered-To: mailing list notifications@freemarker.incubator.apache.org Received: (qmail 99165 invoked by uid 99); 12 Jun 2016 16:53:49 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 12 Jun 2016 16:53:49 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 2077FC1A71 for ; Sun, 12 Jun 2016 16:53:49 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.646 X-Spam-Level: X-Spam-Status: No, score=-4.646 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-1.426] autolearn=disabled Received: from mx2-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id SENsmTDNkObO for ; Sun, 12 Jun 2016 16:53:48 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with SMTP id 5B6266120A for ; Sun, 12 Jun 2016 16:53:45 +0000 (UTC) Received: (qmail 98144 invoked by uid 99); 12 Jun 2016 16:53:42 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 12 Jun 2016 16:53:42 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id DEA5FE0EB5; Sun, 12 Jun 2016 16:53:42 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ddekany@apache.org To: notifications@freemarker.incubator.apache.org Date: Sun, 12 Jun 2016 16:54:13 -0000 Message-Id: <09cfb232c5c04b44ba391b1276df2a46@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [32/50] incubator-freemarker git commit: Added Configurable.getCustomNumberFormatsWithoutFallback and Configurable.getCustomDateFormatsWithoutFallback methods to make it easier for custom code to investigate the Map hierarchy. Improved JavaDoc of the rel archived-at: Sun, 12 Jun 2016 16:53:51 -0000 Added Configurable.getCustomNumberFormatsWithoutFallback and Configurable.getCustomDateFormatsWithoutFallback methods to make it easier for custom code to investigate the Map hierarchy. Improved JavaDoc of the related getters. Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/2b564880 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/2b564880 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/2b564880 Branch: refs/heads/2.3 Commit: 2b56488043930b7dc3be1144dac9ed6e23b9582f Parents: 964757b Author: ddekany Authored: Wed Jun 8 00:57:02 2016 +0200 Committer: ddekany Committed: Wed Jun 8 00:57:02 2016 +0200 ---------------------------------------------------------------------- src/main/java/freemarker/core/Configurable.java | 55 ++++++++++++++++++-- src/manual/en_US/book.xml | 9 ++++ 2 files changed, 61 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/2b564880/src/main/java/freemarker/core/Configurable.java ---------------------------------------------------------------------- diff --git a/src/main/java/freemarker/core/Configurable.java b/src/main/java/freemarker/core/Configurable.java index 18e6fcd..f5776cc 100644 --- a/src/main/java/freemarker/core/Configurable.java +++ b/src/main/java/freemarker/core/Configurable.java @@ -791,13 +791,35 @@ public class Configurable { } /** - * Getter pair of {@link #setCustomNumberFormats(Map)}; do not modify the returned {@link Map}! + * Getter pair of {@link #setCustomNumberFormats(Map)}; do not modify the returned {@link Map}! To be consistent + * with other setting getters, if this setting was set directly on this {@link Configurable} object, this simply + * returns that value, otherwise it returns the value from the parent {@link Configurable}. So beware, the returned + * value doesn't reflect the {@link Map} key granularity fallback logic that FreeMarker actually uses for this + * setting (for that, use {@link #getCustomNumberFormat(String)}). The returned value isn't a snapshot; it may or + * may not shows the changes later made to this setting on this {@link Configurable} level (but usually it's well + * defined if until what point settings are possibly modified). + * + *

+ * The return value is never {@code null}; called on the {@link Configuration} (top) level, it defaults to an empty + * {@link Map}. + * + * @see #getCustomNumberFormatsWithoutFallback() * * @since 2.3.24 */ public Map getCustomNumberFormats() { return customNumberFormats == null ? parent.getCustomNumberFormats() : customNumberFormats; } + + /** + * Like {@link #getCustomNumberFormats()}, but doesn't fall back to the parent {@link Configurable}, nor does it + * provide a non-{@code null} default when called as the method of a {@link Configuration}. + * + * @since 2.3.25 + */ + public Map getCustomNumberFormatsWithoutFallback() { + return customNumberFormats; + } /** * Associates names with formatter factories, which then can be referred by the {@link #setNumberFormat(String) @@ -843,6 +865,8 @@ public class Configurable { } /** + * Tells if this setting is set directly in this object or its value is coming from the {@link #getParent() parent}. + * * @since 2.3.24 */ public boolean isCustomNumberFormatsSet() { @@ -1166,7 +1190,19 @@ public class Configurable { } /** - * Getter pair of {@link #setCustomDateFormats(Map)}; do not modify the returned {@link Map}! + * Getter pair of {@link #setCustomDateFormats(Map)}; do not modify the returned {@link Map}! To be consistent with + * other setting getters, if this setting was set directly on this {@link Configurable} object, this simply returns + * that value, otherwise it returns the value from the parent {@link Configurable}. So beware, the returned value + * doesn't reflect the {@link Map} key granularity fallback logic that FreeMarker actually uses for this setting + * (for that, use {@link #getCustomDateFormat(String)}). The returned value isn't a snapshot; it may or may not + * shows the changes later made to this setting on this {@link Configurable} level (but usually it's well defined if + * until what point settings are possibly modified). + * + *

+ * The return value is never {@code null}; called on the {@link Configuration} (top) level, it defaults to an empty + * {@link Map}. + * + * @see #getCustomDateFormatsWithoutFallback() * * @since 2.3.24 */ @@ -1175,6 +1211,16 @@ public class Configurable { } /** + * Like {@link #getCustomDateFormats()}, but doesn't fall back to the parent {@link Configurable}, nor does it + * provide a non-{@code null} default when called as the method of a {@link Configuration}. + * + * @since 2.3.25 + */ + public Map getCustomDateFormatsWithoutFallback() { + return customDateFormats; + } + + /** * Associates names with formatter factories, which then can be referred by the {@link #setDateTimeFormat(String) * date_format}, {@link #setDateTimeFormat(String) time_format}, and {@link #setDateTimeFormat(String) * datetime_format} settings with values starting with @name. Beware, if you specify any custom @@ -1196,6 +1242,8 @@ public class Configurable { } /** + * Tells if this setting is set directly in this object or its value is coming from the {@link #getParent() parent}. + * * @since 2.3.24 */ public boolean isCustomDateFormatsSet() { @@ -1620,7 +1668,8 @@ public class Configurable { * key is the {@code namespaceVarName}). The order of the auto-imports will be the same as {@link Map#keySet()} * returns the keys (but the order of imports doesn't mater for properly designed libraries anyway). * - * @param map Maps the namepsace variable names to the template names; not {@code null} + * @param map + * Maps the namespace variable names to the template names; not {@code null} */ public void setAutoImports(Map map) { NullArgumentException.check("map", map); http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/2b564880/src/manual/en_US/book.xml ---------------------------------------------------------------------- diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml index 6d56358..cefae69 100644 --- a/src/manual/en_US/book.xml +++ b/src/manual/en_US/book.xml @@ -26649,6 +26649,15 @@ TemplateModel x = env.getVariable("x"); // get variable x + Added + Configurable.getCustomNumberFormatsWithoutFallback + and + Configurable.getCustomDateFormatsWithoutFallback + methods to make it easier for custom code to investigate the + Map hierarchy. + + + Bug fixed (FREEMARKER-18): If you had a JSP custom tag and an EL function defined in the