package org.realityforge.replicant.example.server.service.tyrell.replicate;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Nonnull;
import javax.enterprise.context.Dependent;
import org.realityforge.replicant.example.server.entity.tyrell.Building;
import org.realityforge.replicant.example.server.entity.tyrell.Room;
import org.realityforge.replicant.example.server.entity.tyrell.TyrellRouter;

@Dependent
public class EntityRouter
  implements TyrellRouter
{
  public static final String BUILDING_KEY = "Tyrell.BuildingID";

  @Nonnull
  @Override
  public Map<String, Serializable> routeBuilding( @Nonnull final Building entity )
  {
    final HashMap<String, Serializable> map = new HashMap<>();
    map.put( BUILDING_KEY, entity.getID() );
    return map;
  }

  @Nonnull
  @Override
  public Map<String, Serializable> routeRoom( @Nonnull final Room entity )
  {
    return routeBuilding( entity.getBuilding() );
  }
}

package org.realityforge.replicant.example.server.service.tyrell.replicate;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Nonnull;
import javax.enterprise.context.Dependent;
import org.realityforge.replicant.example.server.entity.TyrellRouter;
import org.realityforge.replicant.example.server.entity.tyrell.Building;
import org.realityforge.replicant.example.server.entity.tyrell.Room;

@Dependent
public class EntityRouter
  implements TyrellRouter
{
  public static final String BUILDING_KEY = "Tyrell.BuildingID";

  @Nonnull
  @Override
  public Map<String, Serializable> routeBuilding( @Nonnull final Building entity )
  {
    final HashMap<String, Serializable> map = new HashMap<>();
    map.put( BUILDING_KEY, entity.getID() );
    return map;
  }

  @Nonnull
  @Override
  public Map<String, Serializable> routeRoom( @Nonnull final Room entity )
  {
    return routeBuilding( entity.getBuilding() );
  }
}

Upgrade to the new Domgen API
Upgrade to the new Domgen API
