GetAnnotation( ) method
- Last Updated: March 13, 2026
- 1 minute read
- OpenEdge
- Version 13.1
- Documentation
Retrieves a specific annotation instance of the requested annotation type that is associated
with the reflected element. The returned object inherits from
Progress.Lang.Annotation and provides read‑only access to the
annotation’s property values stored in r‑code. Because the method returns the base
type Progress.Lang.Annotation, cast the returned object to the
corresponding user‑defined annotation class to access its properties. The instance
is created by the runtime when accessed through reflection.
If the reflected element does not have an annotation of the specified type, the method returns
the unknown value (?). The method raises an error if the specified
type is unknown or if the requested type is not compatible with
Progress.Lang.Annotation.
An overloaded form of this method allows you to search for annotations declared on overridden elements in the class hierarchy. When hierarchical searching is enabled, the runtime first checks the reflected element itself and then searches up the inheritance chain until it finds a matching annotation. Constructors are not inherited, so hierarchical searching has no effect when reflecting on a constructor.
Return type: Progress.Lang.Annotation class
Access: Read-only
Applies to: Progress.Lang.Class class, Progress.Reflect.Constructor class, Progress.Reflect.Event class, Progress.Reflect.Method class, Progress.Reflect.Property class, Progress.Reflect.Variable class
Syntax
|
|
- annotationType
- A
Progress.Lang.Classobject that identifies the annotation class to retrieve. - searchInherited
- A LOGICAL value that specifies whether to search the inheritance hierarchy
for the annotation. If
TRUE, the search proceeds up the class hierarchy until a matching annotation is found.
See also
ANNOTATION statement, [ ] Strongly typed annotation, Progress.Lang.Annotation class, Progress.Lang.Class class, IsAnnotation( ) method, GetAnnotations( ) method, HasAnnotation( ) method