Skip to content

Commit

Permalink
Pass Field to StaticFieldProcessor.process Consumer. (Changed to BiCo…
Browse files Browse the repository at this point in the history
…nsumer)
  • Loading branch information
rotgruengelb committed Jul 30, 2024
1 parent e218632 commit 348e445
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=2.0.1
version=2.0.2
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.function.Consumer;
import java.util.function.BiConsumer;

public class StaticFieldProcessor {

public static <T> void process(Class<?> clazz, Class<T> type, boolean recursive,
Consumer<T> consumer) {
BiConsumer<T, Field> consumer) {
for (Field field : clazz.getDeclaredFields()) {
if (Modifier.isStatic(field.getModifiers()) && type.isAssignableFrom(field.getType())) {
try {
field.setAccessible(true);
consumer.accept((T) field.get(null));
consumer.accept((T) field.get(null), field);
} catch (IllegalAccessException ignored) { }
}
}
Expand Down

0 comments on commit 348e445

Please sign in to comment.