This is an automated email from the ASF dual-hosted git repository.

struberg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/johnzon.git


The following commit(s) were added to refs/heads/master by this push:
     new 251e31b  JOHNZON-364 remove unused methods
251e31b is described below

commit 251e31b6ab8c9024c2a104eeaf41032defa004bd
Author: Mark Struberg <strub...@apache.org>
AuthorDate: Tue Apr 12 11:00:07 2022 +0200

    JOHNZON-364 remove unused methods
---
 .../jsonb/DefaultPropertyVisibilityStrategy.java   | 45 ----------------------
 1 file changed, 45 deletions(-)

diff --git 
a/johnzon-jsonb/src/main/java/org/apache/johnzon/jsonb/DefaultPropertyVisibilityStrategy.java
 
b/johnzon-jsonb/src/main/java/org/apache/johnzon/jsonb/DefaultPropertyVisibilityStrategy.java
index ff854a7..ebf427e 100644
--- 
a/johnzon-jsonb/src/main/java/org/apache/johnzon/jsonb/DefaultPropertyVisibilityStrategy.java
+++ 
b/johnzon-jsonb/src/main/java/org/apache/johnzon/jsonb/DefaultPropertyVisibilityStrategy.java
@@ -27,9 +27,6 @@ import javax.json.bind.config.PropertyVisibilityStrategy;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
@@ -79,49 +76,7 @@ class DefaultPropertyVisibilityStrategy implements 
javax.json.bind.config.Proper
         }
     }
 
-    /**
-     * Calculate all the getters of the given class.
-     */
-    private Map<String, Boolean> calculateGetters(final Class<?> clazz) {
-        final Map<String, Boolean> getters = new HashMap<>();
-        for (final Method m : clazz.getDeclaredMethods()) {
-            if (m.getParameterCount() > 0) {
-                continue;
-            }
-            if (m.getName().startsWith("get") && m.getName().length() > 3) {
-                getters.put(
-                        Character.toLowerCase(m.getName().charAt(3)) + 
m.getName().substring(4),
-                        Modifier.isPublic(m.getModifiers()));
-            } else if (m.getName().startsWith("is") && m.getName().length() > 
2) {
-                getters.put(
-                        Character.toLowerCase(m.getName().charAt(2)) + 
m.getName().substring(3),
-                        Modifier.isPublic(m.getModifiers()));
-            }
-        }
-        final Class<?> superclass = clazz.getSuperclass();
-        if (superclass != Object.class && superclass != null && 
!"java.lang.Record".equals(superclass.getName())) {
-            calculateGetters(superclass).forEach(getters::putIfAbsent); // 
don't override child getter if exists
-        }
-        return getters.isEmpty() ? Collections.emptyMap() : getters;
-    }
 
-    private Map<String, Boolean> calculateSetters(final Class<?> clazz) {
-        final Map<String, Boolean> result = new HashMap<>();
-        for (final Method m : clazz.getDeclaredMethods()) {
-            if (m.getParameterCount() != 1) {
-                continue;
-            }
-            if (m.getName().startsWith("set") && m.getName().length() > 3) {
-                result.put(
-                        Character.toLowerCase(m.getName().charAt(3)) + 
m.getName().substring(4),
-                        Modifier.isPublic(m.getModifiers()));
-            }
-        }
-        if (clazz.getSuperclass() != Object.class) {
-            
calculateSetters(clazz.getSuperclass()).forEach(result::putIfAbsent);
-        }
-        return result.isEmpty() ? Collections.emptyMap() : result;
-    }
 
     @Override
     public boolean isVisible(final Method method) {

Reply via email to