freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject incubator-freemarker git commit: Slight modification to spare the extra pd.getReadMethod() when we have an IndexedPropertyDescriptor and preferIndexedReadMethod is false.
Date Tue, 03 Oct 2017 13:24:36 GMT
Repository: incubator-freemarker
Updated Branches:
  refs/heads/2.3-gae 66af27995 -> a072921d2


Slight modification to spare the extra pd.getReadMethod() when we have an IndexedPropertyDescriptor
and preferIndexedReadMethod is false.


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

Branch: refs/heads/2.3-gae
Commit: a072921d212e63ddb6bff6ec71b95509d6c91e9f
Parents: 66af279
Author: ddekany <ddekany@apache.org>
Authored: Tue Oct 3 15:24:20 2017 +0200
Committer: ddekany <ddekany@apache.org>
Committed: Tue Oct 3 15:24:20 2017 +0200

----------------------------------------------------------------------
 src/main/java/freemarker/ext/beans/BeanModel.java | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a072921d/src/main/java/freemarker/ext/beans/BeanModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/ext/beans/BeanModel.java b/src/main/java/freemarker/ext/beans/BeanModel.java
index 4139b09..01d779a 100644
--- a/src/main/java/freemarker/ext/beans/BeanModel.java
+++ b/src/main/java/freemarker/ext/beans/BeanModel.java
@@ -220,14 +220,15 @@ implements
         TemplateModel resultModel = UNKNOWN;
         if (desc instanceof IndexedPropertyDescriptor) {
             IndexedPropertyDescriptor pd = (IndexedPropertyDescriptor) desc;
-            if (!wrapper.getPreferIndexedReadMethod() && pd.getReadMethod() != null)
{
-                resultModel = wrapper.invokeMethod(object, pd.getReadMethod(), null);
+            Method readMethod;
+            if (!wrapper.getPreferIndexedReadMethod() && (readMethod = pd.getReadMethod())
!= null) {
+                resultModel = wrapper.invokeMethod(object, readMethod, null);
                 // cachedModel remains null, as we don't cache these
             } else {
-                Method readMethod = pd.getIndexedReadMethod(); 
+                Method indexedReadMethod = pd.getIndexedReadMethod(); 
                 resultModel = cachedModel = 
-                    new SimpleMethodModel(object, readMethod, 
-                            ClassIntrospector.getArgTypes(classInfo, readMethod), wrapper);
+                    new SimpleMethodModel(object, indexedReadMethod, 
+                            ClassIntrospector.getArgTypes(classInfo, indexedReadMethod),
wrapper);
             }
         } else if (desc instanceof PropertyDescriptor) {
             PropertyDescriptor pd = (PropertyDescriptor) desc;


Mime
View raw message