urlyy commented on issue #1735:
URL: https://github.com/apache/fury/issues/1735#issuecomment-2244985059

   @Frotty We have added an annotation named `Expose`. And if fileds of a Class 
are annotated with both `@Expose` and `@Ignore`, it will throw a 
RuntimeException. We can only use one kind.
   ```java
   @Data
   @AllArgsConstructor
   private static class ExposeFields {
     @Expose int f1;
     @Expose long f2;
     long f3;
     @Expose ImmutableMap<String, Integer> map1;
     ImmutableMap<String, Integer> map2;
   }
   
   @Test
   public void testExposeFields() {
     Fury fury = Fury.builder().requireClassRegistration(false).build();
     ImmutableMap<String, Integer> map1 = ImmutableMap.of("1", 1);
     ImmutableMap<String, Integer> map2 = ImmutableMap.of("2", 2);
     ExposeFields o = serDe(fury, new ExposeFields(1, 2, 3, map1, map2));
     assertEquals(1, o.f1);
     assertEquals(2, o.f2);
     assertEquals(0, o.f3);
     assertEquals(o.map1, map1);
     assertNull(o.map2);
   }
   
   @Data
   @AllArgsConstructor
   private static class ExposeFields2 {
     @Expose int f1;
     @Ignore long f2;
     long f3;
   }
   
   @Test
   public void testExposeFields2() {
     Fury fury = Fury.builder().requireClassRegistration(false).build();
     assertThrows(RuntimeException.class, () -> serDe(fury, new 
ExposeFields2(1, 2, 3)));
   }
   ```
   


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to