package org.realityforge.replicant.client;

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

/**
 * Representation of a subscription to a graph.
 */
public class GraphSubscriptionEntry
{
  private final GraphDescriptor _descriptor;

  @Nullable
  private final Map<Class<?>, Map<Object, EntitySubscriptionEntry>> _entities =
    new HashMap<Class<?>, Map<Object, EntitySubscriptionEntry>>();
  private final Map<Class<?>, Map<Object, EntitySubscriptionEntry>> _roEntities =
    Collections.unmodifiableMap( _entities );

  public GraphSubscriptionEntry( final GraphDescriptor descriptor )
  {
    _descriptor = descriptor;
  }

  public GraphDescriptor getDescriptor()
  {
    return _descriptor;
  }

  public Map<Class<?>, Map<Object, EntitySubscriptionEntry>> getEntities()
  {
    return _roEntities;
  }

  final Map<Class<?>, Map<Object, EntitySubscriptionEntry>> getRwEntities()
  {
    return _entities;
  }
}

@@ -111,24 +111,57 @@
 a.util.Map;%0A
+import javax.annotation.Nonnull;%0A
 import javax
@@ -182,16 +182,16 @@
 llable;%0A
-
 %0A/**%0A * 
@@ -246,16 +246,22 @@
 %0Apublic 
+final 
 class Gr
@@ -328,17 +328,16 @@
 riptor;%0A
-%0A
   @Nulla
@@ -340,16 +340,43 @@
 ullable%0A
+  private Object _filter;%0A%0A
   privat
@@ -643,16 +643,218 @@
 ies );%0A%0A
+  public GraphSubscriptionEntry( @Nonnull final GraphDescriptor descriptor,%0A                                 @Nullable final Object filter )%0A  %7B%0A    _descriptor = descriptor;%0A    _filter = filter;%0A  %7D%0A%0A
   public
@@ -917,37 +917,29 @@
 r )%0A  %7B%0A    
-_descriptor =
+this(
  descriptor;
@@ -929,32 +929,40 @@
 this( descriptor
+, null )
 ;%0A  %7D%0A%0A  public 
@@ -993,24 +993,24 @@
 iptor()%0A  %7B%0A
-
     return _
@@ -1018,32 +1018,160 @@
 escriptor;%0A  %7D%0A%0A
+  void setFilter( final Object filter )%0A  %7B%0A    _filter = filter;%0A  %7D%0A%0A  public Object getFilter()%0A  %7B%0A    return _filter;%0A  %7D%0A%0A
   public Map%3CCla

Make sure subscription entry can hold the filter value