@Nullable
  public static <T> T safeCast(Object obj, Class<T> expectedClass) {
    if (expectedClass.isInstance(obj)) {
      @SuppressWarnings("unchecked") T t = (T)obj;
      return t;
    }
    return null;
  }
@Nullable
  public static <T> T safeCast(Object obj, Class<T> expectedClass)