Annotation Interface BeanIgnore
The bean-modeling sibling of @MarshalledIgnore: where @MarshalledIgnore (in
Behavior depends on the target:
- TYPE (class) — marks the class as not a bean. The marshaller falls through to
its other type-detection logic (object swaps,
@BeanType-style hints,@Marshalled(as=STRING), etc.) instead of treating the class as a bean. - FIELD — excludes the field from bean property discovery. Use
ignoreAccessors()to also suppress matching JavaBean accessors. - METHOD — excludes the getter/setter from bean property discovery.
- CONSTRUCTOR — excludes the constructor from constructor detection.
Java Records:
Ignoring individual record components is not supported during parsing. Because records are immutable, all components must be provided to the canonical constructor. Applying this annotation to a record component's accessor method or field will exclude it from serialization output, but the parser will be unable to instantiate the record if the component value is missing from the input.
See Also:
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionString[]Optional description for the exposed API.booleanWhentrue and this annotation is on afield , JavaBean accessors (getX /setX ,isX ) for the same logical property are also excluded from bean metadata.
-
Element Details
-
description
Optional description for the exposed API.- Returns:
- The annotation value.
- Since:
- 9.2.0
- Default:
- {}
-
ignoreAccessors
boolean ignoreAccessorsWhentrue and this annotation is on afield , JavaBean accessors (getX /setX ,isX ) for the same logical property are also excluded from bean metadata.Default is
false :@BeanIgnoreon a field only excludes the field from field-based discovery; accessors can still expose the property (for example when bean field visibility is set toNONE). Set totrue to omit the property from serialization and parsing while keeping accessors for other frameworks.- Returns:
- The annotation value.
- Default:
- false
-