zstan commented on code in PR #13002:
URL: https://github.com/apache/ignite/pull/13002#discussion_r3063962872


##########
docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/WorkingWithBinaryObjects.java:
##########
@@ -142,6 +142,45 @@ public static void configuringBinaryObjects() {
 
     }
 
+    //tag::keepBinaryWithCacheInterceptor[]
+    public static void cacheWithInterceptorExample() {
+        try (Ignite ignite = Ignition.start()) {
+            CacheConfiguration specConfig = new 
CacheConfiguration("personSpecCache");
+            ccfg.setInterceptor(new CustomInterceptor(false));
+            IgniteCache<Integer, Person> cache = ignite.createCache(ccfg);
+            cache.put(1, new Person(1, "FirstPerson"));
+
+            CacheConfiguration boConfig = new 
CacheConfiguration("boSpecCache");
+            ccfg.setInterceptor(new CustomInterceptor(true));
+            IgniteCache<Integer, Person> cache = ignite.createCache(ccfg);
+            cache = cache.withKeepBinary();
+            cache.put(1, new Person(1, "FirstPerson"));
+        }
+    }
+
+    private static class CustomInterceptor implements CacheInterceptor<Object, 
Object> {
+        boolean keepBinary;
+
+        CustomInterceptor(boolean keepBinary) {
+            this.keepBinary = keepBinary;
+        }
+
+        @Nullable @Override public Object onBeforePut(Cache.Entry<Object, 
Object> entry, Object newVal) {
+            assertEquals(keepBinary, newVal instanceof BinaryObject);

Review Comment:
   fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to