001package arez.component;
002
003import javax.annotation.Nonnull;
004
005/**
006 * Interface implemented by components that have references that need to be eagerly resolved.
007 * The method on this interface should only be invoked by the runtime and not directly by external code.
008 */
009public interface Linkable
010{
011  /**
012   * Resolve any references.
013   */
014  void link();
015
016  /**
017   * Link specified object if it is linkable.
018   *
019   * @param object the object to link if linkable.
020   */
021  static void link( @Nonnull final Object object )
022  {
023    if ( object instanceof Linkable )
024    {
025      final Linkable linkable = (Linkable) object;
026      linkable.link();
027    }
028  }
029}