Actually it should already be possible to use `@JsonIgnoreProperties`
for properties as is, but I think it only affects property value
itself, and not contents of containers.
But it seems reasonable to assume that since Lists/arrays/Maps do not
have properties of their own (except in non-standard case of being
serialized "as POJOs"...), this annotation would refer to values. This
is similar to how `@JsonTypeInfo` works.

If there isn't yet an issue to support this, could you please file one
for `jackson-databind`.
I don't know how easy it would be to support this, but conceptually it
seems straightforward.

-+ Tatu +-


On Mon, Mar 20, 2017 at 12:56 AM, Obby Kipchumba <santanao...@gmail.com> wrote:
> Let;s say you have the following classes.
>
> class Client {
>       List<Vehicle> vehicles;
> }
>
>
> Class Vehicle {
>
>
>       Client owner;
> }
>
>
>
> What I want to have is a field level annotation as such.
>
> class Client {
>
>       // something like this
>       @JsonIgnoreProperties (forEach="owner")
>       List<Vehicle> vehicles;
> }
>
>
> Class Vehicle {
>
>       @JsonIgnoreProperties ("vehicles")
>       Client owner;
> }
>
>
>
> This is so as to prevent recursion based on the contaxt you are in. I mean
> If I have a client object and i'm getting it's vehicles, i don't want the
> owner details since I already have the client object but when i have a
> vehicle object I will need to know it's owner information but exclude the
> list of the vehicles the client has. Isn't this something that someone has
> needed at some point in time?
>
> When you use at class level, like this
>
> @JsonIgnoreProperties ("owner")
>
> Class Vehicle {
>
>       Client owner;
> }
>
>
> This will ignore  the owner all the time regardless of context. Can the
> above feature be made possible?
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "jackson-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jackson-user+unsubscr...@googlegroups.com.
> To post to this group, send email to jackson-user@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jackson-user+unsubscr...@googlegroups.com.
To post to this group, send email to jackson-user@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to