Contents > 8 Defining Custom Design Metrics and Rules > 8.1 Definition of Metrics > 8.1.3 Attribute Value

8.1.3 Attribute Value

You can define a metric which returns the value of a SDMetrics metamodel attribute of an element or a related element. This is useful if you want attribute values to appear in the output table, and it can help simplify the definition of other metrics. For example, to show the "visibility" attribute for elements of type "operation" in the output tables:
<metric name="visibility" domain="class"> 
  <description>The visibility of the operation.</description>
  <attributevalue attr="visibility"/>
</metric>
An attributevalue element has three attributes: The below examples demonstrates the "element" attribute. The metric shows the name of a parameter's type.
<metric name="typename" domain="parameter"> 
  <description>The parameter type name.</description>
  <attributevalue element="parametertype" attr="name"/>
</metric>