LabelList interface

Represents a read-only list of labels applied to an object.

Construction

Use O.labelList().

Interface

acts as Array

A LabelList acts as an Array of Ref objects. Use [] to retrieve the Ref at the given index.

property length

The number of labels in the list.

function includes(ref)

true if the list includes the label, otherwise false.

function filterToLabelsOfType(types)

Returns a new LabelList which contains all the labels from this list which are of one of the types specified by types, an array of one or more Ref objects.

The types specified are matched exactly, ignoring the hierarchy of sub-types. If you need to filter including sub-types, you will have to pass all the sub-types in yourself.

For example, to filter a list so it only contains labels configured in system management, use:

    var filtered = labels.filterToLabelsOfType([TYPE["std:type:label"]]);