getDescriptionFromAnnotation
Extracts the description text from an annotation if it matches a recognized description annotation.
This method performs case-insensitive matching of the annotation's simple name against descriptionAnnotationNames. If matched, it searches the annotation's arguments for any parameter names that match descriptionValueAttributes and returns the first non-null String value found.
Recognition Logic
The annotation is matched by simple name only (not fully qualified name)
Matching is case-insensitive for both annotation names and parameter names
The first matching parameter with a non-null String value is returned
Example Usage
// With @Description annotation
@Description("A purchasable product with pricing and inventory info.")
class Product
val description = Introspections.getDescriptionFromAnnotation(
annotationName = "Description",
annotationArguments = listOf("value" to "A purchasable product with pricing and inventory info.")
)
// description == "A purchasable product with pricing and inventory info."// With Jackson annotation
@JsonPropertyDescription(description = "User's email address")
val email: String
val description = Introspections.getDescriptionFromAnnotation(
annotationName = "JsonPropertyDescription",
annotationArguments = listOf("description" to "User's email address")
)
// description == "User's email address"Return
The description text if found, or null if the annotation is not recognized or contains no matching description parameter
Parameters
The simple name of the annotation to inspect (e.g., "Description", "P")
List of key-value pairs representing the annotation's parameters