<attribute-group> Element

Specifies a group of attributes that must be applied in keeping with specified occurrence rules.

Syntax

<attribute-group 
    group-type="at-most-one | exactly-one | at-least-one" 
>

Attributes

group-type

Specifies the occurrence rule for attributes in this group. For attributes in an attribute group, you can specify the following rules that should be used when a developer is using the control and applying attributes from the group:

  • at-most-one: Only one of the attributes defined in the group may be used, or none may be used.
  • exactly-one: Only one of the attributes defined in the group may be used, but one must be used.
  • at-least-one: At least one of the attributes defined in the group must be used, but more may be used.

Allowable values: at-most-one, exactly-one, at-least-one

Use: Required.

Type: AttributeGroupType.

Default value: None.

Type

This element contains a list of attribute elements.

Hierarchy

Parent: control-tag or method-tag.

Children: A sequence of attributes.

Remarks

Use this element to define two or more attributes whose presence as annotations on a control or method is mutually dependent. For example, you might have a control that retrieves information from a file, but the file may be available through a file path or over HTTP. You could define an attribute group that includes a fileName attribute whose value must be a file-path and a fileURL attribute whose value must be a URL. Defining this in an attribute group whose group-type is exactly-one ensures that the developer will use only one of the attributes.

Related Topics

Control Property Schema Reference

Tutorial: Java Control