Skip to content

Commit

Permalink
foo
Browse files Browse the repository at this point in the history
  • Loading branch information
reuvenlax committed Oct 12, 2024
1 parent 98ff57e commit a6062a3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ public static List<Method> getMethods(Class<?> clazz) {
return DECLARED_METHODS.computeIfAbsent(
clazz,
c -> {
Map<String, Method> types = new LinkedHashMap<>();
;
List<Method> methods = Lists.newArrayList();
do {
if (c.getPackage() != null && c.getPackage().getName().startsWith("java.")) {
break; // skip java built-in classes
Expand All @@ -103,10 +102,10 @@ public static List<Method> getMethods(Class<?> clazz) {
.filter(m -> !Modifier.isPrivate(m.getModifiers()))
.filter(m -> !Modifier.isProtected(m.getModifiers()))
.filter(m -> !Modifier.isStatic(m.getModifiers()))
.forEach(m -> types.put(m.getName(), m));
.forEach(methods::add);
c = c.getSuperclass();
} while (c != null);
return Lists.newArrayList(types.values());
return methods;
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -1045,7 +1046,8 @@ FieldValueSetter<ProtoBuilderT, Object> getProtoFieldValueSetter(
} else {
Method method = getProtoSetter(methods, field.getName(), field.getType());
return JavaBeanUtils.createSetter(
FieldValueTypeInformation.forSetter(method, protoSetterPrefix(field.getType())),
FieldValueTypeInformation.forSetter(
method, protoSetterPrefix(field.getType()), Collections.emptyMap()),
new ProtoTypeConversionsFactory());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.protobuf.DynamicMessage;
import com.google.protobuf.Message;
import java.lang.reflect.Method;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.apache.beam.sdk.extensions.protobuf.ProtoByteBuddyUtils.ProtoTypeConversionsFactory;
Expand Down Expand Up @@ -72,7 +73,8 @@ public List<FieldValueTypeInformation> get(TypeDescriptor<?> typeDescriptor, Sch
Method method = getProtoGetter(methods, oneOfField.getName(), oneOfField.getType());
oneOfTypes.put(
oneOfField.getName(),
FieldValueTypeInformation.forGetter(method, i).withName(field.getName()));
FieldValueTypeInformation.forGetter(method, i, Collections.emptyMap())
.withName(field.getName()));
}
// Add an entry that encapsulates information about all possible getters.
types.add(
Expand All @@ -82,7 +84,9 @@ public List<FieldValueTypeInformation> get(TypeDescriptor<?> typeDescriptor, Sch
} else {
// This is a simple field. Add the getter.
Method method = getProtoGetter(methods, field.getName(), field.getType());
types.add(FieldValueTypeInformation.forGetter(method, i).withName(field.getName()));
types.add(
FieldValueTypeInformation.forGetter(method, i, Collections.emptyMap())
.withName(field.getName()));
}
}
return types;
Expand Down

0 comments on commit a6062a3

Please sign in to comment.