Reference

Contains a reference to a component and a locator to find it.

Description

The Reference class allows you to store a reference to a component and a locator to find it.

Important points

  • It is used by References to store registered component references.

Constructors

NewReference

Create a new instance of the reference object and assigns its values.

NewReference(locator any, component any) *Reference

  • locator: any - locator to find the reference.
  • component: any - reference to a component.

Methods

Component

Gets the stored component reference.

(c *Reference) Component() any

  • returns: any - component’s references.

Locator

Gets the stored component locator.

(c *Reference) Locator() any

  • returns: any - component’s locator.

Match

Matches locator to this reference locator. Descriptors are matched using equal method. All other locator types are matched using direct comparison.

(c *Reference) Match(locator any) bool

  • locator: any - the locator to match.
  • returns: bool - true if locators are matching and false it they don’t.