All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.realityforge.replicant.client.EntitySubscriptionEntry Maven / Gradle / Ivy

There is a newer version: 5.98-arez-b23
Show newest version
package org.realityforge.replicant.client;

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

/**
 * Representation of a subscriptions that impact entity.
 */
public class EntitySubscriptionEntry
{
  private final Map _graphSubscriptions = new HashMap<>();
  private final Map _roGraphSubscriptions =
    Collections.unmodifiableMap( _graphSubscriptions );
  private final Class _type;
  private final Object _id;

  public EntitySubscriptionEntry( @Nonnull final Class type, @Nonnull final Object id )
  {
    _type = type;
    _id = id;
  }

  @Nonnull
  public Class getType()
  {
    return _type;
  }

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

  public Map getGraphSubscriptions()
  {
    return _roGraphSubscriptions;
  }

  final Map getRwGraphSubscriptions()
  {
    return _graphSubscriptions;
  }

  @Nullable
  public ChannelSubscriptionEntry deregisterGraph( @Nonnull final ChannelDescriptor descriptor )
  {
    return getRwGraphSubscriptions().remove( descriptor );
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy