@SuppressWarnings("unchecked")
  @Override
  public <T> Optional<T> adapt(Class<T> clazz) {
    if (clazz.isInstance(udf)) {
      return Optional.of((T) udf);
    }
    return super.adapt(clazz);
  }
Gets the UDF class and checks it against the whitelist, if any.
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFBridge.java