Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redundant call to Reflector#getClassMethods() #2335

Merged
merged 3 commits into from
Sep 7, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Cosmetic changes
  • Loading branch information
harawata committed Sep 7, 2021
commit bd26999622c43b68a2252f349b71986c0a6e7d6d
23 changes: 12 additions & 11 deletions src/main/java/org/apache/ibatis/reflection/Reflector.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@
*/
package org.apache.ibatis.reflection;

import org.apache.ibatis.reflection.invoker.AmbiguousMethodInvoker;
import org.apache.ibatis.reflection.invoker.GetFieldInvoker;
import org.apache.ibatis.reflection.invoker.Invoker;
import org.apache.ibatis.reflection.invoker.MethodInvoker;
import org.apache.ibatis.reflection.invoker.SetFieldInvoker;
import org.apache.ibatis.reflection.property.PropertyNamer;
import org.apache.ibatis.util.MapUtil;

import java.lang.reflect.Array;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
Expand All @@ -42,6 +34,14 @@
import java.util.Map;
import java.util.Map.Entry;

harawata marked this conversation as resolved.
Show resolved Hide resolved
import org.apache.ibatis.reflection.invoker.AmbiguousMethodInvoker;
import org.apache.ibatis.reflection.invoker.GetFieldInvoker;
import org.apache.ibatis.reflection.invoker.Invoker;
import org.apache.ibatis.reflection.invoker.MethodInvoker;
import org.apache.ibatis.reflection.invoker.SetFieldInvoker;
import org.apache.ibatis.reflection.property.PropertyNamer;
import org.apache.ibatis.util.MapUtil;

/**
* This class represents a cached set of class definition information that
* allows for easy mapping between property names and getter/setter methods.
Expand All @@ -64,9 +64,9 @@ public class Reflector {
public Reflector(Class<?> clazz) {
type = clazz;
addDefaultConstructor(clazz);
Method [] allMethods = getClassMethods(clazz);
addGetMethods(allMethods);
addSetMethods(allMethods);
Method[] classMethods = getClassMethods(clazz);
addGetMethods(classMethods);
addSetMethods(classMethods);
addFields(clazz);
readablePropertyNames = getMethods.keySet().toArray(new String[0]);
writablePropertyNames = setMethods.keySet().toArray(new String[0]);
Expand Down Expand Up @@ -289,6 +289,7 @@ private Method[] getClassMethods(Class<?> clazz) {
}

Collection<Method> methods = uniqueMethods.values();

return methods.toArray(new Method[0]);
}

Expand Down