From ea6afd7f5053a164fe48e04b2f226dc8b6558910 Mon Sep 17 00:00:00 2001 From: Jerry Lee Date: Sat, 6 Apr 2024 18:52:56 +0800 Subject: [PATCH] WIP --- README.md | 6 +- .../inspectablewrappers/Inspector.java | 170 ++++++++++++++++-- src/test/java/io/foldright/demo/Demo.java | 6 +- .../demo/integration/IntegrationDemo.java | 4 +- ...tegrationDemoUsingWrapperAdapterUtils.java | 4 +- .../inspectablewrappers/WrapperAdapterTest.kt | 16 +- .../inspectablewrappers/WrapperTest.kt | 14 +- .../utils/WrapperAdapterUtilsTest.kt | 12 +- 8 files changed, 185 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 71366dd..2cbf484 100644 --- a/README.md +++ b/README.md @@ -132,7 +132,7 @@ public class Demo { //////////////////////////////////////// System.out.println("Is executor lazy? " + - containsInstanceOnWrapperChain(executor, LazyExecutorWrapper.class)); + containsInstanceTypeOnWrapperChain(executor, LazyExecutorWrapper.class)); // print true String busy = getAttachmentFromWrapperChain(executor, "busy"); @@ -208,7 +208,7 @@ public class IntegrationDemo { //////////////////////////////////////// System.out.println("Is executor ExistedExecutorWrapper? " + - containsInstanceOnWrapperChain(executor, ExistedExecutorWrapper.class)); + containsInstanceTypeOnWrapperChain(executor, ExistedExecutorWrapper.class)); // print true String adaptAttachment = getAttachmentFromWrapperChain(executor, "adapted-existed-executor-wrapper-msg"); System.out.println("Adapted existed executor wrapper msg: " + adaptAttachment); @@ -305,7 +305,7 @@ public class IntegrationDemoUsingWrapperAdapterUtils { //////////////////////////////////////// System.out.println("Is executor ExistedExecutorWrapper? " + - containsInstanceOnWrapperChain(executor, ExistedExecutorWrapper.class)); + containsInstanceTypeOnWrapperChain(executor, ExistedExecutorWrapper.class)); // print true String adaptAttachment = getAttachmentFromWrapperChain(executor, "adapted-existed-executor-wrapper-msg"); System.out.println("Adapted existed executor wrapper msg: " + adaptAttachment); diff --git a/src/main/java/io/foldright/inspectablewrappers/Inspector.java b/src/main/java/io/foldright/inspectablewrappers/Inspector.java index d15846e..08adc7d 100644 --- a/src/main/java/io/foldright/inspectablewrappers/Inspector.java +++ b/src/main/java/io/foldright/inspectablewrappers/Inspector.java @@ -3,9 +3,13 @@ import edu.umd.cs.findbugs.annotations.DefaultAnnotationForParameters; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.Nullable; +import org.jetbrains.annotations.Contract; +import java.util.ArrayList; import java.util.IdentityHashMap; +import java.util.List; import java.util.Optional; +import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Predicate; import java.util.function.Supplier; @@ -19,7 +23,7 @@ *

Common simple usages

*