NETJVM 

Attributes, Custom Attributes

Attributes (previously custom attributes) are used to provide additional information about elements within your program. Much of the syntax used in a COBOL program describes program elements, such as the visibility of methods and fields (PUBLIC, PRIVATE, PROTECTED, etc.). All these descriptions are embedded as ‘Metadata’ into the dll or exe file output by the Compiler, and can be interrogated by other programs using Reflection. Attributes are a way of adding additional metadata to program elements in a way that is open ended and unlimited. Attributes are attached to COBOL items using the ATTRIBUTE reserved word.

Attributes may be used to describe methods, data items, properties, events, delegates, method parameters, assemblies, classes and method return values.

The arguments you specify for the attribute are of two types:

For example:

 01 a binary-long attribute xml("UpperB").

The ordinary parameters used in the attribute specification must match a constructor defined by the attribute. In the example above, the constructor expects a single parameter of type string.

As another example:

attribute WebService(NAME Description="My service")

The named parameters must match properties defined by the attribute. In this example, Description is a property of type string defined for the attribute class WebService.

The attributes supported in COBOL are broadly similar to annotations supported in other languages for JVM.