You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fury.apache.org by "Frotty (via GitHub)" <gi...@apache.org> on 2024/07/17 12:23:14 UTC
[I] FR: Only serialize annotated fields [fury]
Frotty opened a new issue, #1735:
URL: https://github.com/apache/fury/issues/1735
## Is your feature request related to a problem? Please describe.
I want to move an existing project to fury, but right now data fields in classes are marked with an annotation. Fury only supports not de-/serializing transient fields, but it's not convenient to mark a majority of fields as transient.
## Describe the solution you'd like
I would like there to be an annotation that allows me to mark only the fields of a class that should be de-/serialized.
## Additional context
This was discussed @chaokunyang in https://www.reddit.com/r/java/comments/1cll68f/comment/ld3suns/?context=3 and he is generally supportive. However, there seems to be no real guide for me to start implementing this. Perhaps someone else can do it in a shorter amount of time.
--
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: commits-unsubscribe@fury.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org
Re: [I] FR: Only serialize annotated fields [fury]
Posted by "urlyy (via GitHub)" <gi...@apache.org>.
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: commits-unsubscribe@fury.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org
Re: [I] FR: Only serialize annotated fields [fury]
Posted by "urlyy (via GitHub)" <gi...@apache.org>.
urlyy commented on issue #1735:
URL: https://github.com/apache/fury/issues/1735#issuecomment-2241643481
@chaokunyang I'm interested in this issue. However , as it's my first time delving into the Java version of Fury, I'm not quite sure if my approach is correct. By using DEBUG, I've traced the code and found a method which obtains the list of fields of the object being serialized, this `descriptorMap` ultimately also participates in serializer codegen. Here is already a check on the `Ignore` annotation; I need to modify the logic.
Do you have some advice? To be honest I don't know if it's enough to modify this method , maybe I should explore more.

--
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: commits-unsubscribe@fury.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org
Re: [I] FR: Only serialize annotated fields [fury]
Posted by "Frotty (via GitHub)" <gi...@apache.org>.
Frotty commented on issue #1735:
URL: https://github.com/apache/fury/issues/1735#issuecomment-2241756361
Cool, would be nice to see this implemented. I suppose there must be a configuration or mode, or annotation on the class itself, to switch the fury behavior to only serialize marked fields. Otherwise, might be quite straightforward. Currently, the annotation is `@Exposed` but I don't really care about the name.
--
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: commits-unsubscribe@fury.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org
Re: [I] FR: Only serialize annotated fields [fury]
Posted by "chaokunyang (via GitHub)" <gi...@apache.org>.
chaokunyang commented on issue #1735:
URL: https://github.com/apache/fury/issues/1735#issuecomment-2254575577
> I wasn't able to test it yet, when will it be available in a release?
You can use snapshot jar for test. A release jar will be released by the end of this week
--
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: commits-unsubscribe@fury.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org
Re: [I] FR: Only serialize annotated fields [fury]
Posted by "Frotty (via GitHub)" <gi...@apache.org>.
Frotty commented on issue #1735:
URL: https://github.com/apache/fury/issues/1735#issuecomment-2254453739
I wasn't able to test it yet, when will it be available in a release?
--
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: commits-unsubscribe@fury.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org
Re: [I] FR: Only serialize annotated fields [fury]
Posted by "chaokunyang (via GitHub)" <gi...@apache.org>.
chaokunyang closed issue #1735: FR: Only serialize annotated fields
URL: https://github.com/apache/fury/issues/1735
--
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: commits-unsubscribe@fury.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org
Re: [I] FR: Only serialize annotated fields [fury]
Posted by "Pil0tXia (via GitHub)" <gi...@apache.org>.
Pil0tXia commented on issue #1735:
URL: https://github.com/apache/fury/issues/1735#issuecomment-2254236642
Good job. Might we consider this issue as completed?
--
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: commits-unsubscribe@fury.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org
Re: [I] FR: Only serialize annotated fields [fury]
Posted by "chaokunyang (via GitHub)" <gi...@apache.org>.
chaokunyang commented on issue #1735:
URL: https://github.com/apache/fury/issues/1735#issuecomment-2241938166
The implementation should not be complex, but the naming is an issue. This is a public API, how do we name this annotation?
--
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: commits-unsubscribe@fury.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org