class SamplerFunctions {

  public static <T> SamplerFunction<T> nullSafe(SamplerFunction<T> delegate) {
    if (delegate == null) throw new NullPointerException("delegate == null");
    if (delegate instanceof Constants || delegate instanceof NullSafe) return delegate;
    return new NullSafe<>(delegate);
  }

}