private static boolean idsMatcher(EntityId e1, EntityId e2) { return e1.getIsPattern() && e2.getId().matches(e1.getId()) || e2.getIsPattern() && e1.getId().matches(e2.getId()) || e2.getId().equals(e1.getId()); }