Get unknown symbol (struct, method, class) tagged with User Defined Attributes

Doug overprose at gmail.com
Tue May 12 02:51:39 UTC 2020


I've seen a lot of examples of how to get a list of User Defined 
Attributes from a known symbol but I haven't seen any for how to 
get a list of symbols when only the UDA is known.

The use case is the same as seen in Rust with Serde[1]. Library 
users annotate a struct to mark it for serialization. In Java and 
Spring, you can mark a method with @Secured to add authorization 
to an endpoint[2]. In both of these cases, you have no idea which 
symbol the UDA will be applied to.

So far I've only seen a way to get unknown UDAs from known 
symbols but not how to get unknown symbols from UDAs. Is there 
any documentation for how to get a list of symbols annotated with 
a specific UDA?


1: Serde: https://github.com/serde-rs/json
2: Spring: 
https://www.baeldung.com/spring-security-method-security



More information about the Digitalmars-d-learn mailing list