class JavaMethodReflectionFunctionMissing implements FunctionMissing {

  private static final long serialVersionUID = -7829608231403725185L;

  private JavaMethodReflectionFunctionMissing() {

  }

  private static final JavaMethodReflectionFunctionMissing INSTANCE =
      new JavaMethodReflectionFunctionMissing();

  /**
   * Retrieve a global singleton JavaMethodReflectionFunctionMissing instance.
   *
   * @return
   */
  public static JavaMethodReflectionFunctionMissing getInstance() {
    return INSTANCE;
  }

  @Override
  public AviatorObject onFunctionMissing(final String name, final Map<String, Object> env,
      final AviatorObject... args) {<FILL_FUNCTION_BODY>}

}


    if (args == null || args.length < 1) {
      throw new FunctionNotFoundException(
          "Function not found: " + name + ", could not resolve with no arguments");
    }

    Object firstArg = args[0].getValue(env);

    if (firstArg == null) {
      throw new FunctionNotFoundException(
          "Function not found: " + name + ", the first argument is null");
    }

    Class<?> clazz = firstArg.getClass();


    Object[] jArgs = new Object[args.length - 1];
    for (int i = 1; i < args.length; i++) {
      jArgs[i - 1] = args[i].getValue(env);
    }

    return FunctionUtils.wrapReturn(Reflector.invokeInstanceMethod(clazz, name, firstArg,
        Reflector.getInstanceMethods(clazz, name), jArgs));
  
<no_super_class>