getannotations
Purpose
Get model annotations associated to a given symbol.
Synopsis
procedure getannotations(id:string, prefix:string, si:set of string, ann:array(string) of string)
procedure getannotations(id:string, prefix:string, lsa:list of string)
Arguments
|
id
|
Symbol for which annotations are requested (an empty string will report global annotations)
|
|
prefix
|
Prefix filter: only annotations with a name starting with the specified prefix will be returned
|
|
si
|
Set receiving the annotation names
|
|
ann
|
Array receiving the annotation values (indexed by anootation names)
|
|
lsa
|
List receiving the annotation names and values
|
Example
The following code snippet implements a function to retrieve a specific annotation for the specified model entity (if several matching annotations are found the value of the first is returned):
public function getannot(symb:string, aname:string):string
declarations
l:list of string
end-declarations
getannotations(symb,aname,l)
if l.size>=2 and l(1)=aname then
returned:=l(2)
end-if
end-function
writeln("Value of first annotation 'my.annot' for entity 'x': ",
getannot("x","my.annot"))
writeln("Value of first global annotation 'my.annot': ",
getannot("","my.annot"))
Further information
With the version taking a list, each annotation is represented by 2 entries: the first one is the annotation name and the second one its value. Note that the version returning information via an array will only report partial information in the case of annotations defined several times.
Related topics
Module
© 2001-2023 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation ("FICO"). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.
