|
26 | 26 | import java.beans.PropertyDescriptor; |
27 | 27 | import java.lang.annotation.Annotation; |
28 | 28 | import java.lang.reflect.Method; |
| 29 | +import java.lang.reflect.Modifier; |
29 | 30 | import java.lang.reflect.Type; |
30 | 31 | import java.util.Collection; |
31 | 32 | import java.util.HashMap; |
@@ -53,6 +54,7 @@ public Map<String, Reader> doFindReaders(final Class<?> clazz) { |
53 | 54 | if (isRecord(clazz) || Meta.getAnnotation(clazz, JohnzonRecord.class) != null) { |
54 | 55 | readers.putAll(Stream.of(clazz.getMethods()) |
55 | 56 | .filter(it -> it.getDeclaringClass() != Object.class && it.getParameterCount() == 0) |
| 57 | + .filter(it -> !Modifier.isStatic(it.getModifiers())) |
56 | 58 | .filter(it -> !"toString".equals(it.getName()) && !"hashCode".equals(it.getName())) |
57 | 59 | .filter(it -> !isIgnored(it.getName()) && Meta.getAnnotation(it, JohnzonAny.class) == null) |
58 | 60 | .collect(toMap(m -> extractKey(m.getName(), m, null), it -> new MethodReader(it, it.getGenericReturnType())))); |
@@ -92,10 +94,10 @@ public Map<String, Writer> doFindWriters(final Class<?> clazz) { |
92 | 94 | final Method writeMethod = descriptor.getWriteMethod(); |
93 | 95 | if (writeMethod != null) { |
94 | 96 | writers.put(extractKey(descriptor.getName(), writeMethod, descriptor.getReadMethod()), |
95 | | - new MethodWriter(writeMethod, writeMethod.getGenericParameterTypes()[0])); |
| 97 | + new MethodWriter(writeMethod, writeMethod.getGenericParameterTypes()[0])); |
96 | 98 | } else if (supportGetterAsWritter |
97 | | - && Collection.class.isAssignableFrom(descriptor.getPropertyType()) |
98 | | - && descriptor.getReadMethod() != null) { |
| 99 | + && Collection.class.isAssignableFrom(descriptor.getPropertyType()) |
| 100 | + && descriptor.getReadMethod() != null) { |
99 | 101 | final Method readMethod = descriptor.getReadMethod(); |
100 | 102 | writers.put(extractKey(descriptor.getName(), readMethod, null), new MethodGetterAsWriter(readMethod, readMethod.getGenericReturnType())); |
101 | 103 | } |
@@ -169,8 +171,8 @@ public boolean isNillable(final boolean global) { |
169 | 171 | @Override |
170 | 172 | public String toString() { |
171 | 173 | return "MethodDecoratedType{" + |
172 | | - "method=" + method + |
173 | | - '}'; |
| 174 | + "method=" + method + |
| 175 | + '}'; |
174 | 176 | } |
175 | 177 | } |
176 | 178 |
|
|
0 commit comments