package org.realityforge.replicant.client;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Nullable;

/**
 * Representation of a subscriptions that impact entity.
 */
public class EntitySubscriptionEntry
{
  private final Class<?> _type;
  @Nullable
  private final Object _id;

  @Nullable
  private final Map<GraphDescriptor, GraphSubscriptionEntry> _graphSubscriptions =
    new HashMap<GraphDescriptor, GraphSubscriptionEntry>();
  private final Map<GraphDescriptor, GraphSubscriptionEntry> _roGraphSubscriptions =
    Collections.unmodifiableMap( _graphSubscriptions );

  public EntitySubscriptionEntry( final Class<?> type, final Object id )
  {
    _type = type;
    _id = id;
  }

  public Class<?> getType()
  {
    return _type;
  }

  @Nullable
  public Object getID()
  {
    return _id;
  }

  public Map<GraphDescriptor, GraphSubscriptionEntry> getGraphSubscriptions()
  {
    return _roGraphSubscriptions;
  }

  final Map<GraphDescriptor, GraphSubscriptionEntry> getRwGraphSubscriptions()
  {
    return _graphSubscriptions;
  }
}

@@ -140,23 +140,22 @@
 tation.N
+onn
 ull
-able
 ;%0A%0A/**%0A 
@@ -257,93 +257,8 @@
 y%0A%7B%0A
-  private final Class%3C?%3E _type;%0A  @Nullable%0A  private final Object _id;%0A%0A  @Nullable%0A
   pr
@@ -536,16 +536,76 @@
 tions );
+%0A  private final Class%3C?%3E _type;%0A  private final Object _id;
 %0A%0A  publ
@@ -631,16 +631,25 @@
 onEntry(
+ @Nonnull
  final C
@@ -661,16 +661,25 @@
 ?%3E type,
+ @Nonnull
  final O
@@ -722,32 +722,43 @@
  _id = id;%0A  %7D%0A%0A
+  @Nonnull%0A
   public Class%3C?
@@ -804,15 +804,14 @@
   @N
+onn
 ull
-able
 %0A  p

Correct the nullability annotations