package org.realityforge.replicant.client;

import arez.component.NoSuchEntityException;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

/**
 * The service interface for looking up entities by type+id.
 * This is used from within the entities during linking phase.
 */
public interface EntityLocator
{
  @Nonnull
  default <T> T getByID( @Nonnull final Class<T> type, @Nonnull final Object id )
  {
    final T entity = findById( type, id );
    if ( null == entity )
    {
      throw new NoSuchEntityException( id );
    }
    return entity;
  }

  /**
   * Lookup an entity of specified type with specified id, returning null if not present.
   *
   * @param type the type of the entity.
   * @param id   the id of the entity.
   * @param <T>  the entity type.
   * @return the entity or null if no such entity.
   */
  @Nullable
  <T> T findById( @Nonnull Class<T> type, @Nonnull Object id );
}

@@ -352,9 +352,9 @@
 tByI
-D
+d
 ( @N

Update naming convention