freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject [1/9] incubator-freemarker git commit: FREEMARKER-55: narrow class/method visibilities as possible.
Date Thu, 14 Sep 2017 09:14:10 GMT
Repository: incubator-freemarker
Updated Branches:
  refs/heads/3 742ed4fee -> f6eebd856


FREEMARKER-55: narrow class/method visibilities as possible.


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/40bd07b7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/40bd07b7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/40bd07b7

Branch: refs/heads/3
Commit: 40bd07b718262e30345c082ec4794ab2535b5fd8
Parents: 5f6a917
Author: Woonsan Ko <woonsan@apache.org>
Authored: Wed Sep 13 10:49:36 2017 -0400
Committer: Woonsan Ko <woonsan@apache.org>
Committed: Wed Sep 13 10:49:36 2017 -0400

----------------------------------------------------------------------
 .../model/AbstractSpringTemplateCallableModel.java       |  4 ++--
 .../model/AbstractSpringTemplateDirectiveModel.java      |  4 ++--
 .../model/AbstractSpringTemplateFunctionModel.java       |  4 ++--
 .../apache/freemarker/spring/model/BindDirective.java    |  4 ++--
 .../freemarker/spring/model/BindErrorsDirective.java     |  4 ++--
 .../org/apache/freemarker/spring/model/EvalFunction.java |  6 +++---
 .../apache/freemarker/spring/model/MessageFunction.java  | 11 ++++++++---
 .../freemarker/spring/model/NestedPathDirective.java     |  4 ++--
 .../spring/model/SpringTemplateCallableHashModel.java    |  9 +++++----
 .../apache/freemarker/spring/model/ThemeFunction.java    |  5 +++--
 .../freemarker/spring/model/TransformFunction.java       |  6 +++---
 .../org/apache/freemarker/spring/model/UrlFunction.java  |  6 +++---
 12 files changed, 37 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/40bd07b7/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/AbstractSpringTemplateCallableModel.java
----------------------------------------------------------------------
diff --git a/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/AbstractSpringTemplateCallableModel.java
b/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/AbstractSpringTemplateCallableModel.java
index 641fbdb..03142d6 100644
--- a/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/AbstractSpringTemplateCallableModel.java
+++ b/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/AbstractSpringTemplateCallableModel.java
@@ -34,7 +34,7 @@ import org.springframework.web.servlet.support.RequestContext;
 /**
  * Abstract TemplateCallableModel for derived classes to support Spring MVC based templating
environment.
  */
-public abstract class AbstractSpringTemplateCallableModel implements TemplateCallableModel
{
+abstract class AbstractSpringTemplateCallableModel implements TemplateCallableModel {
 
     private final HttpServletRequest request;
     private final HttpServletResponse response;
@@ -44,7 +44,7 @@ public abstract class AbstractSpringTemplateCallableModel implements TemplateCal
      * @param request servlet request
      * @param response servlet response
      */
-    public AbstractSpringTemplateCallableModel(HttpServletRequest request, HttpServletResponse
response) {
+    protected AbstractSpringTemplateCallableModel(HttpServletRequest request, HttpServletResponse
response) {
         this.request = request;
         this.response = response;
     }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/40bd07b7/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/AbstractSpringTemplateDirectiveModel.java
----------------------------------------------------------------------
diff --git a/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/AbstractSpringTemplateDirectiveModel.java
b/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/AbstractSpringTemplateDirectiveModel.java
index 0ce34d0..a02558f 100644
--- a/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/AbstractSpringTemplateDirectiveModel.java
+++ b/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/AbstractSpringTemplateDirectiveModel.java
@@ -39,7 +39,7 @@ import org.springframework.web.servlet.view.AbstractTemplateView;
 /**
  * Abstract TemplateDirectiveModel for derived classes to support Spring MVC based templating
environment.
  */
-public abstract class AbstractSpringTemplateDirectiveModel extends AbstractSpringTemplateCallableModel
+abstract class AbstractSpringTemplateDirectiveModel extends AbstractSpringTemplateCallableModel
         implements TemplateDirectiveModel {
 
     /**
@@ -47,7 +47,7 @@ public abstract class AbstractSpringTemplateDirectiveModel extends AbstractSprin
      * @param request servlet request
      * @param response servlet response
      */
-    public AbstractSpringTemplateDirectiveModel(HttpServletRequest request, HttpServletResponse
response) {
+    protected AbstractSpringTemplateDirectiveModel(HttpServletRequest request, HttpServletResponse
response) {
         super(request, response);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/40bd07b7/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/AbstractSpringTemplateFunctionModel.java
----------------------------------------------------------------------
diff --git a/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/AbstractSpringTemplateFunctionModel.java
b/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/AbstractSpringTemplateFunctionModel.java
index 137837c..90bd3df 100644
--- a/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/AbstractSpringTemplateFunctionModel.java
+++ b/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/AbstractSpringTemplateFunctionModel.java
@@ -36,7 +36,7 @@ import org.springframework.web.servlet.view.AbstractTemplateView;
 /**
  * Abstract TemplateFunctionModel for derived classes to support Spring MVC based templating
environment.
  */
-public abstract class AbstractSpringTemplateFunctionModel extends AbstractSpringTemplateCallableModel
+abstract class AbstractSpringTemplateFunctionModel extends AbstractSpringTemplateCallableModel
         implements TemplateFunctionModel {
 
     /**
@@ -44,7 +44,7 @@ public abstract class AbstractSpringTemplateFunctionModel extends AbstractSpring
      * @param request servlet request
      * @param response servlet response
      */
-    public AbstractSpringTemplateFunctionModel(HttpServletRequest request, HttpServletResponse
response) {
+    protected AbstractSpringTemplateFunctionModel(HttpServletRequest request, HttpServletResponse
response) {
         super(request, response);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/40bd07b7/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/BindDirective.java
----------------------------------------------------------------------
diff --git a/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/BindDirective.java
b/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/BindDirective.java
index 99f5f86..1a3917c 100644
--- a/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/BindDirective.java
+++ b/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/BindDirective.java
@@ -62,7 +62,7 @@ import org.springframework.web.servlet.support.RequestContext;
  * because it is much easier to control escaping in FreeMarker Template expressions.
  * </P>
  */
-public class BindDirective extends AbstractSpringTemplateDirectiveModel {
+class BindDirective extends AbstractSpringTemplateDirectiveModel {
 
     public static final String NAME = "bind";
 
@@ -79,7 +79,7 @@ public class BindDirective extends AbstractSpringTemplateDirectiveModel
{
                     false
                     );
 
-    public BindDirective(HttpServletRequest request, HttpServletResponse response) {
+    protected BindDirective(HttpServletRequest request, HttpServletResponse response) {
         super(request, response);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/40bd07b7/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/BindErrorsDirective.java
----------------------------------------------------------------------
diff --git a/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/BindErrorsDirective.java
b/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/BindErrorsDirective.java
index 2b73780..2f6a93e 100644
--- a/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/BindErrorsDirective.java
+++ b/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/BindErrorsDirective.java
@@ -65,7 +65,7 @@ import org.springframework.web.servlet.support.RequestContext;
  * rather than depending on directives.
  * </P>
  */
-public class BindErrorsDirective extends AbstractSpringTemplateDirectiveModel {
+class BindErrorsDirective extends AbstractSpringTemplateDirectiveModel {
 
     public static final String NAME = "hasBindErrors";
 
@@ -79,7 +79,7 @@ public class BindErrorsDirective extends AbstractSpringTemplateDirectiveModel
{
                     false
                     );
 
-    public BindErrorsDirective(HttpServletRequest request, HttpServletResponse response)
{
+    protected BindErrorsDirective(HttpServletRequest request, HttpServletResponse response)
{
         super(request, response);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/40bd07b7/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/EvalFunction.java
----------------------------------------------------------------------
diff --git a/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/EvalFunction.java
b/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/EvalFunction.java
index 39d210e..2c257c4 100644
--- a/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/EvalFunction.java
+++ b/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/EvalFunction.java
@@ -75,7 +75,7 @@ import org.springframework.web.servlet.support.RequestContext;
  * because it is much easier to control escaping in FreeMarker Template expressions.
  * </P>
  */
-public class EvalFunction extends AbstractSpringTemplateFunctionModel {
+class EvalFunction extends AbstractSpringTemplateFunctionModel {
 
     public static final String NAME = "eval";
 
@@ -93,12 +93,12 @@ public class EvalFunction extends AbstractSpringTemplateFunctionModel
{
 
     private final ExpressionParser expressionParser = new SpelExpressionParser();
 
-    public EvalFunction(HttpServletRequest request, HttpServletResponse response) {
+    protected EvalFunction(HttpServletRequest request, HttpServletResponse response) {
         super(request, response);
     }
 
     @Override
-    public TemplateModel executeInternal(TemplateModel[] args, CallPlace callPlace, Environment
env,
+    protected TemplateModel executeInternal(TemplateModel[] args, CallPlace callPlace, Environment
env,
             ObjectWrapperAndUnwrapper objectWrapperAndUnwrapper, RequestContext requestContext)
                     throws TemplateException {
         final String expressionString = CallableUtils.getStringArgument(args, EXPRESSION_PARAM_IDX,
this);

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/40bd07b7/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/MessageFunction.java
----------------------------------------------------------------------
diff --git a/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/MessageFunction.java
b/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/MessageFunction.java
index f30e07b..c7b6db5 100644
--- a/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/MessageFunction.java
+++ b/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/MessageFunction.java
@@ -74,7 +74,7 @@ import org.springframework.web.servlet.support.RequestContext;
  * because it is much easier to control escaping in FreeMarker Template expressions.
  * </P>
  */
-public class MessageFunction extends AbstractSpringTemplateFunctionModel {
+class MessageFunction extends AbstractSpringTemplateFunctionModel {
 
     public static final String NAME = "message";
 
@@ -92,12 +92,12 @@ public class MessageFunction extends AbstractSpringTemplateFunctionModel
{
                     false
                     );
 
-    public MessageFunction(HttpServletRequest request, HttpServletResponse response) {
+    protected MessageFunction(HttpServletRequest request, HttpServletResponse response) {
         super(request, response);
     }
 
     @Override
-    public TemplateModel executeInternal(TemplateModel[] args, CallPlace callPlace, Environment
env,
+    protected TemplateModel executeInternal(TemplateModel[] args, CallPlace callPlace, Environment
env,
             ObjectWrapperAndUnwrapper objectWrapperAndUnwrapper, RequestContext requestContext)
                     throws TemplateException {
         final MessageSource messageSource = getMessageSource(requestContext);
@@ -149,6 +149,11 @@ public class MessageFunction extends AbstractSpringTemplateFunctionModel
{
         return ARGS_LAYOUT;
     }
 
+    /**
+     * Get the {@link MessageSource} bean from the current application context.
+     * @param requestContext Spring Framework RequestContext
+     * @return the {@link MessageSource} bean from the current application context
+     */
     protected MessageSource getMessageSource(final RequestContext requestContext) {
         return requestContext.getMessageSource();
     }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/40bd07b7/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/NestedPathDirective.java
----------------------------------------------------------------------
diff --git a/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/NestedPathDirective.java
b/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/NestedPathDirective.java
index b24dfaf..43788f6 100644
--- a/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/NestedPathDirective.java
+++ b/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/NestedPathDirective.java
@@ -54,7 +54,7 @@ import org.springframework.web.servlet.support.RequestContext;
  *   &lt;/@spring.nestedPath&gt;
  * </PRE>
  */
-public class NestedPathDirective extends AbstractSpringTemplateDirectiveModel {
+class NestedPathDirective extends AbstractSpringTemplateDirectiveModel {
 
     public static final String NAME = "nestedPath";
 
@@ -68,7 +68,7 @@ public class NestedPathDirective extends AbstractSpringTemplateDirectiveModel
{
                     false
                     );
 
-    public NestedPathDirective(HttpServletRequest request, HttpServletResponse response)
{
+    protected NestedPathDirective(HttpServletRequest request, HttpServletResponse response)
{
         super(request, response);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/40bd07b7/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/SpringTemplateCallableHashModel.java
----------------------------------------------------------------------
diff --git a/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/SpringTemplateCallableHashModel.java
b/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/SpringTemplateCallableHashModel.java
index 4e42923..8afb4ab 100644
--- a/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/SpringTemplateCallableHashModel.java
+++ b/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/SpringTemplateCallableHashModel.java
@@ -68,6 +68,7 @@ public final class SpringTemplateCallableHashModel implements TemplateHashModel,
         modelsMap.put(EvalFunction.NAME, new EvalFunction(request, response));
     }
 
+    @Override
     public TemplateModel get(String key) throws TemplateException {
         return modelsMap.get(key);
     }
@@ -77,19 +78,19 @@ public final class SpringTemplateCallableHashModel implements TemplateHashModel,
         return false;
     }
 
-    public TemplateStringModel getNestedPathModel() throws TemplateException {
+    TemplateStringModel getNestedPathModel() throws TemplateException {
         return (TemplateStringModel) get(NESTED_PATH_MODEL);
     }
 
-    public void setNestedPathModel(TemplateStringModel nestedPathModel) {
+    void setNestedPathModel(TemplateStringModel nestedPathModel) {
         modelsMap.put(NESTED_PATH_MODEL, nestedPathModel);
     }
 
-    public TemplateModel getEvaluationContextModel() throws TemplateException {
+    TemplateModel getEvaluationContextModel() throws TemplateException {
         return (TemplateModel) get(EVALUATION_CONTEXT_MODEL);
     }
 
-    public void setEvaluationContextModel(TemplateModel evaluationContextModel) {
+    void setEvaluationContextModel(TemplateModel evaluationContextModel) {
         modelsMap.put(EVALUATION_CONTEXT_MODEL, evaluationContextModel);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/40bd07b7/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/ThemeFunction.java
----------------------------------------------------------------------
diff --git a/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/ThemeFunction.java
b/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/ThemeFunction.java
index 4f201ad..ca457a7 100644
--- a/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/ThemeFunction.java
+++ b/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/ThemeFunction.java
@@ -57,14 +57,15 @@ import org.springframework.web.servlet.support.RequestContext;
  * because it is much easier to control escaping in FreeMarker Template expressions.
  * </P>
  */
-public class ThemeFunction extends MessageFunction {
+class ThemeFunction extends MessageFunction {
 
     public static final String NAME = "theme";
 
-    public ThemeFunction(HttpServletRequest request, HttpServletResponse response) {
+    protected ThemeFunction(HttpServletRequest request, HttpServletResponse response) {
         super(request, response);
     }
 
+    @Override
     protected MessageSource getMessageSource(final RequestContext requestContext) {
         return requestContext.getTheme().getMessageSource();
     }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/40bd07b7/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/TransformFunction.java
----------------------------------------------------------------------
diff --git a/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/TransformFunction.java
b/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/TransformFunction.java
index 6110652..96258a7 100644
--- a/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/TransformFunction.java
+++ b/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/TransformFunction.java
@@ -50,7 +50,7 @@ import org.springframework.web.servlet.support.RequestContext;
  * because it is much easier to control escaping in FreeMarker Template expressions.
  * </P>
  */
-public class TransformFunction extends AbstractSpringTemplateFunctionModel {
+class TransformFunction extends AbstractSpringTemplateFunctionModel {
 
     public static final String NAME = "transform";
 
@@ -65,12 +65,12 @@ public class TransformFunction extends AbstractSpringTemplateFunctionModel
{
                     false
                     );
 
-    public TransformFunction(HttpServletRequest request, HttpServletResponse response) {
+    protected TransformFunction(HttpServletRequest request, HttpServletResponse response)
{
         super(request, response);
     }
 
     @Override
-    public TemplateModel executeInternal(TemplateModel[] args, CallPlace callPlace, Environment
env,
+    protected TemplateModel executeInternal(TemplateModel[] args, CallPlace callPlace, Environment
env,
             ObjectWrapperAndUnwrapper objectWrapperAndUnwrapper, RequestContext requestContext)
                     throws TemplateException {
         final TemplateModel editorModel = CallableUtils.getOptionalArgument(args, PROPERTY_EDITOR_PARAM_IDX,

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/40bd07b7/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/UrlFunction.java
----------------------------------------------------------------------
diff --git a/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/UrlFunction.java
b/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/UrlFunction.java
index 47c83ab..908b3de 100644
--- a/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/UrlFunction.java
+++ b/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/UrlFunction.java
@@ -68,7 +68,7 @@ import org.springframework.web.util.UriUtils;
  * because it is much easier to control escaping in FreeMarker Template expressions.
  * </P>
  */
-public class UrlFunction extends AbstractSpringTemplateFunctionModel {
+class UrlFunction extends AbstractSpringTemplateFunctionModel {
 
     public static final String NAME = "url";
 
@@ -95,12 +95,12 @@ public class UrlFunction extends AbstractSpringTemplateFunctionModel {
                     true
                     );
 
-    public UrlFunction(HttpServletRequest request, HttpServletResponse response) {
+    protected UrlFunction(HttpServletRequest request, HttpServletResponse response) {
         super(request, response);
     }
 
     @Override
-    public TemplateModel executeInternal(TemplateModel[] args, CallPlace callPlace, Environment
env,
+    protected TemplateModel executeInternal(TemplateModel[] args, CallPlace callPlace, Environment
env,
             ObjectWrapperAndUnwrapper objectWrapperAndUnwrapper, RequestContext requestContext)
                     throws TemplateException {
         final String value = CallableUtils.getStringArgument(args, VALUE_PARAM_IDX, this);


Mime
View raw message