Interface Identifiable<K>

Type Parameters:
K - the type of the id.

public interface Identifiable<K>
Interface implemented by components so that the underlying identifier can be exposed. The ArezId is used by Arez classes when manipulating the component. As long as Disposable.dispose() has not been invoked on the component then the ArezId value should be unique within the scope of the ArezContext.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <K> Identifiable<K>
    Cast specified object to instance of Identifiable.
    Return the unique id of the component.
    static <K> K
    getArezId(Object object)
    Return the unique id of the object if it is Identifiable, else return null.
  • Method Details

    • getArezId

      @Nonnull K getArezId()
      Return the unique id of the component. As long as Disposable.dispose() has not been invoked on the component, the return value should be unique within the scope of the ArezContext.
      Returns:
      the unique id of the component.
    • getArezId

      @Nullable static <K> K getArezId(@Nullable Object object)
      Return the unique id of the object if it is Identifiable, else return null.
      Type Parameters:
      K - the type of the id.
      Parameters:
      object - the object to dispose.
      Returns:
      the arez id if the object is Identifiable, otherwise null.
    • asIdentifiable

      @Nonnull static <K> Identifiable<K> asIdentifiable(@Nonnull Object object)
      Cast specified object to instance of Identifiable. Invariant checks will verify that the cast is valid before proceeding.
      Type Parameters:
      K - the type parameter for Identifiable.
      Parameters:
      object - the object.
      Returns:
      the object cast to Identifiable.