There is currently no way to prevent the DefinitionProvider() from always returning all public methods. I have a lot of objects that calculate values out of other properties and I don't want these to be exported, because they are just for making handling easier (like asking an object for its height and width, but creating it by giving a set of dots in a coordination system).
Is there any way to achieve this?
I can't seem to solve this elegantly by providing my own DefinitionProvider, because it's a final class and not an interface I can code against. The only halfway elegant solution seems creating a derived class of ObjectMapperUsingReflection and overriding serializeObject(). That seems way over the top.
I'd love to be able to turn off this behavior, preferably by an attribute like (#[SerializeMethods(true/false)]) or something similar on the object being serialized. Just a suggestion. I might be missing something important, but right now, I feel a bit clueless.
There is currently no way to prevent the
DefinitionProvider()
from always returning all public methods. I have a lot of objects that calculate values out of other properties and I don't want these to be exported, because they are just for making handling easier (like asking an object for its height and width, but creating it by giving a set of dots in a coordination system). Is there any way to achieve this? I can't seem to solve this elegantly by providing my ownDefinitionProvider
, because it's a final class and not an interface I can code against. The only halfway elegant solution seems creating a derived class ofObjectMapperUsingReflection
and overridingserializeObject()
. That seems way over the top.I'd love to be able to turn off this behavior, preferably by an attribute like (
#[SerializeMethods(true/false)]
) or something similar on the object being serialized. Just a suggestion. I might be missing something important, but right now, I feel a bit clueless.