package util.sqlparse.visitor.hivetdh;

import org.apache.commons.jexl2.JexlInfo;
import org.apache.commons.jexl2.introspection.JexlMethod;
import org.apache.commons.jexl2.introspection.JexlPropertyGet;
import org.apache.commons.jexl2.introspection.JexlPropertySet;
import org.apache.commons.jexl2.introspection.Uberspect;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.Iterator;
import java.util.Locale;

public class UberspectImpl implements Uberspect {
   ClassLoader classLoader;

   public void setClassLoader(ClassLoader loader) {
      this.classLoader = loader;
   }

   public Constructor<?> getConstructor(Object ctorHandle, Object[] args, JexlInfo info) {
      return null;
   }

   public JexlMethod getConstructorMethod(Object o, Object[] objects, JexlInfo jexlInfo) {
      return null;
   }

   public JexlMethod getMethod(Object obj, String method, Object[] args, JexlInfo info) {
      Class[] types = new Class[args.length];

      for(int i = 0; i < args.length; ++i) {
         types[i] = args[i].getClass();
      }

      try {
         Method methodInfo = obj.getClass().getMethod(method.toLowerCase(Locale.ROOT), types);
         return new JexlMethodImpl(methodInfo);
      } catch (NoSuchMethodException e) {
         e.printStackTrace();
         return null;
      }
   }

   public JexlPropertyGet getPropertyGet(Object obj, Object identifier, JexlInfo info) {
      return null;
   }

   public JexlPropertySet getPropertySet(Object obj, Object identifier, Object arg, JexlInfo info) {
      return null;
   }

   public Iterator<?> getIterator(Object obj, JexlInfo info) {
      return null;
   }
}
