The
ATTRIBUTE or
CUSTOM-ATTRIBUTE clause specifies an attribute that provides metadata (information) about a
.NET COBOL code native data item or a property that will be visible using reflection.
Format 1
{ ATTRIBUTE attribute-name(constructor-params, NAME property-name = property-value, ...) } ...
Format
2 (for Backward Compatibility)
{ CUSTOM-ATTRIBUTE IS class-name-1 [ ( {parameter-1} . . . ) ] }...
Syntax Rules for Format 1
- Attribute-name can be specified without quotes and can optionally omit the trailing "Attribute" part of the name.
- Constructor-params are the standard parameters to the required attribute constructor. For example:
attribute Marshal-Attribute(3)
- The name/value pairs, preceded by the keyword NAME are used to set any required attribute properties. Property-name can be
specified without quotes. For example:
attribute WebService(NAME Description="My service")
Syntax Rules for Format
2 (for Backward Compatibility)
- This list of parameters must match a constructor defined for class-name-1. Each parameter-1 must be one of the following:
General Rules
- The custom attribute specified becomes part of the metadata describing the subject of the entry and is visible to a reflector.
- Languages for JVM support annotations, which are similar broadly to attributes in COBOL.