Annotation Interface NameProperty
This annotation is used by parsers to automatically set the name/key of an object when parsing structured data (e.g., JSON maps, XML elements). A common use case is when parsing a map where the map key should be stored as a property on the bean.
Requirements:
- Must be an instance method or field (not static)
- For methods: Must accept exactly one parameter (any type)
- For fields: Can be any type
- The method or field does not need to be public (will be made accessible automatically)
Can be used in the following locations:
- Bean setter methods or fields
@Rest -annotated classes and@RestOp -annotated methods when used with@NamePropertyApply
Example:
When It's Called:
- During parsing when an object is created as a value in a map/collection
- The parser automatically calls the setter or sets the field with the key/name from the parent structure
See Also:
-
Optional Element Summary
Optional Elements
-
Element Details
-
description
Optional description for the exposed API.- Returns:
- The annotation value.
- Since:
- 9.2.0
- Default:
- {}
-