public static void writeExternal(@NotNull Object data,
                                   @NotNull Element parentNode,
                                   @Nullable("null means all elements are accepted") JDOMFilter filter) throws WriteExternalException {
    if (filter instanceof Predicate<?>) {
      //noinspection unchecked
      write(data, parentNode, (Predicate<Field>)filter);
    }
    else {
      write(data, parentNode, filter == null ? null : field -> filter.isAccept(field));
    }
  }
public static void writeExternal(@NotNull Object data,
                                   @NotNull Element parentNode,
                                   @Nullable("null means all elements are accepted") JDOMFilter filter)