Internal method to invoke the performed for the passed list of objects.

@param aObjectsToPerform
List of objects to be passed to the performer. Never
<code>null</code>. The length is at last
{@link #getMaxPerformCount()}.
@return {@link ESuccess}
431703
@Nonnull
  private ESuccess _perform (@Nonnull final List <DATATYPE> aObjectsToPerform)
  {
    if (!aObjectsToPerform.isEmpty ())
    {
      try
      {
        // Perform the action on the objects, regardless of whether a
        // "stop queue message" was received or not
        m_aPerformer.runAsync (aObjectsToPerform);
      }
      catch (final Exception ex)
      {
        LOGGER.error ("Failed to perform actions on " +
                      aObjectsToPerform.size () +
                      " objects with performer " +
                      m_aPerformer +
                      " - objects are lost!",
                      ex);
        return ESuccess.FAILURE;
      }

      // clear perform-list anyway
      aObjectsToPerform.clear ();
    }

    return ESuccess.SUCCESS;
  }
985354
public static Object invokeMethod(Object obj, String methodName, Object... params) {
        Method method = findMethod(obj, methodName, params);
        return invokeMethod(obj, method, params);
    }
960949
@Override
    public List<KeyedMessageWithType> invokeOutput(final T instance) throws DempsyException {
        if (outputMethods == null)
            return emptyKeyedMessageList;

        final List<KeyedMessageWithType> ret = new ArrayList<>();
        for (final Method om : outputMethods) {
            final Object or = wrap(() -> om.invoke(instance));
            if (or != null) {
                ret.addAll(convertToKeyedMessage(or));
            }
        }

        return ret.size() == 0 ? null : ret;
    }
819437
public int getMaximumNumberOfInstances(final InstanceType instanceType) {

		final Integer val = this.maximumMap.get(instanceType);
		if (val != null) {
			return val.intValue();
		}

		return 0;
	}
1144504
@Override
    public Object invoke(Object[] vals) throws InvocationTargetException {
        Object[] tmp;
        int i;

        try {
            if (isStatic()) {
                return meth.invoke(null, vals);
            } else {
                if (vals.length == 0) {
                    throw new IllegalArgumentException("invalid arguments");
                }

                tmp = new Object[vals.length - 1];
                for (i = 1; i < vals.length; i++) {
                    tmp[i-1] = vals[i];
                }

                return meth.invoke(vals[0], tmp);
            }
        } catch (InvocationTargetException | IllegalArgumentException e) {
            throw e;
        } catch (IllegalAccessException e) {
            // isValid should prevent this
            throw new RuntimeException("can't access method");
        }
    }
209687
@Override
    protected void doPerform() {
        WebElement targetElem = getFirstElement(target);
        if (targetOffset == null) {
            getActions().dragAndDrop(getFirstElement(), targetElem).perform();
        } else {
            org.openqa.selenium.Dimension size = targetElem.getSize();
            Dimension dimension = new Dimension(size.width, size.height);
            Point offsetPoint = targetOffset.offset(dimension);
            getActions().dragAndDropBy(getFirstElement(), offsetPoint.x(), offsetPoint.y()).perform();
        }
    }
862362
public Object executeService(ContainerWrapper cw) throws Exception {
		Debug.logVerbose("[JdonFramework]enter service execution core ", module);
		Object result = null;
		try {
			AopClient aopClient = (AopClient) cw.lookup(ComponentKeys.AOP_CLIENT);
			result = aopClient.invoke();
		} catch (Exception ex) {
			Debug.logError("[JdonFramework] execute the service error: " + ex, module);
			throw new Exception("execute service error: " + ex);
		} catch (Throwable ex) {
			Debug.logError("[JdonFramework]  execute Service error: " + ex, module);
			throw new Exception("  execute Service error: " + ex);
		}
		return result;
	}
314513
@SuppressWarnings("unchecked")
    public static <T> T performMethodInvocation(Object tested, Method methodToInvoke, Object... arguments)
            throws Exception {
        final boolean accessible = methodToInvoke.isAccessible();
        if (!accessible) {
            methodToInvoke.setAccessible(true);
        }
        try {
            if (isPotentialVarArgsMethod(methodToInvoke, arguments)) {
                Class<?>[] parameterTypes = methodToInvoke.getParameterTypes();
                final int varArgsIndex = parameterTypes.length - 1;
                Class<?> varArgsType = parameterTypes[varArgsIndex].getComponentType();
                Object varArgsArrayInstance = createAndPopulateVarArgsArray(varArgsType, varArgsIndex, arguments);
                Object[] completeArgumentList = new Object[parameterTypes.length];
                System.arraycopy(arguments, 0, completeArgumentList, 0, varArgsIndex);
                completeArgumentList[completeArgumentList.length - 1] = varArgsArrayInstance;
                return (T) methodToInvoke.invoke(tested, completeArgumentList);
            } else {
                return (T) methodToInvoke.invoke(tested, arguments == null ? new Object[]{arguments} : arguments);
            }
        } catch (InvocationTargetException e) {
            Throwable cause = e.getCause();
            if (cause instanceof Exception) {
                throw (Exception) cause;
            } else if (cause instanceof Error) {
                throw (Error) cause;
            } else {
                throw new MethodInvocationException(cause);
            }
        } finally {
            if (!accessible) {
                methodToInvoke.setAccessible(false);
            }
        }
    }
844007
int calculateMaxProgress(MappingTarget mappingTarget) {
    int batches = mappingTarget.getEntityMappings().stream().mapToInt(this::countBatches).sum();
    if (mappingTarget.hasSelfReferences()) {
      batches *= 2;
    }
    return batches;
  }
1324452
public static Object invokeObjectMethod(
            Object object, String methodName, Object[] args,
            Interpreter interpreter, CallStack callstack,
            SimpleNode callerInfo ) throws ReflectError, EvalError,
            InvocationTargetException {
        // Bsh scripted object
        if ( object instanceof This && !This.isExposedThisMethod(methodName) )
            return ((This)object).invokeMethod(
                methodName, args, interpreter, callstack, callerInfo,
                false/*delcaredOnly*/);

        // Plain Java object, find the java method
        try {
            BshClassManager bcm =
                interpreter == null ? null : interpreter.getClassManager();
            Class<?> clas = object.getClass();

            Invocable method = resolveExpectedJavaMethod(
                bcm, clas, object, methodName, args, false );
            NameSpace ns = getThisNS(object);
            if (null != ns)
                ns.setNode(callerInfo);
            return method.invoke(object, args);
        } catch ( UtilEvalError e ) {
            throw e.toEvalError( callerInfo, callstack );
        }
    }
165831
@Nonnull
  public static Class <?> [] getClassArray (@Nullable final Object... aObjs)
  {
    if (ArrayHelper.isEmpty (aObjs))
      return EMPTY_CLASS_ARRAY;

    final Class <?> [] ret = new Class <?> [aObjs.length];
    for (int i = 0; i < aObjs.length; ++i)
      ret[i] = aObjs[i].getClass ();
    return ret;
  }
1245737
public Object invoke(MethodInvocation mi) throws Throwable {
		if (!Modifier.isPublic(mi.getMethod().getModifiers())) {
			return mi.proceed();
		}

		Method daoMethod = mi.getMethod();
		Object[] args = mi.getArguments();
		String appid = AOPUtils.getFirstArgOfString(args);

		Method superMethod = null;
		Indexed indexedAnno = null;
		Cached cachedAnno = null;

		try {
			superMethod = DAO.class.getMethod(daoMethod.getName(), daoMethod.getParameterTypes());
			indexedAnno = Config.isSearchEnabled() ? superMethod.getAnnotation(Indexed.class) : null;
			cachedAnno = Config.isCacheEnabled() ? superMethod.getAnnotation(Cached.class) : null;
			detectNestedInvocations(daoMethod);
		} catch (Exception e) {
			logger.error("Error in AOP layer!", e);
		}

		Set<IOListener> ioListeners = Para.getIOListeners();
		for (IOListener ioListener : ioListeners) {
			ioListener.onPreInvoke(superMethod, args);
			logger.debug("Executed {}.onPreInvoke().", ioListener.getClass().getName());
		}

		Object result = handleIndexing(indexedAnno, appid, daoMethod, args, mi);
		Object cachingResult = handleCaching(cachedAnno, appid, daoMethod, args, mi);

		// we have a read operation without any result but we get back objects from cache
		if (result == null && cachingResult != null) {
			result = cachingResult;
		}

		// both searching and caching are disabled - pass it through
		if (indexedAnno == null && cachedAnno == null) {
			result = invokeDAO(appid, daoMethod, mi);
		}

		for (IOListener ioListener : ioListeners) {
			ioListener.onPostInvoke(superMethod, result);
			logger.debug("Executed {}.onPostInvoke().", ioListener.getClass().getName());
		}

		return result;
	}
150326
private XAnnotationInvocationHandler asOneOfUs(Object o) {
		if (Proxy.isProxyClass(o.getClass())) {
			InvocationHandler handler = Proxy.getInvocationHandler(o);
			if (handler instanceof XAnnotationInvocationHandler)
				return (XAnnotationInvocationHandler) handler;
		}
		return null;
	}
380820
@Override
    protected void createForwardingMethodBody(ClassMethod classMethod, final MethodInformation methodInfo, ClassMethod staticConstructor) {
        final Method method = methodInfo.getMethod();
        // we can only use bytecode based invocation for some methods
        // at the moment we restrict it solely to public methods with public
        // return and parameter types
        boolean bytecodeInvocationAllowed = Modifier.isPublic(method.getModifiers()) && Modifier.isPublic(method.getReturnType().getModifiers());
        for (Class<?> paramType : method.getParameterTypes()) {
            if (!Modifier.isPublic(paramType.getModifiers())) {
                bytecodeInvocationAllowed = false;
                break;
            }
        }
        if (!bytecodeInvocationAllowed) {
            createInterceptorBody(classMethod, methodInfo, staticConstructor);
            return;
        }

        // create a new interceptor invocation context whenever we invoke a method on a client proxy
        // we use a try-catch block in order to make sure that endInterceptorContext() is invoked regardless whether
        // the method has succeeded or not

        new RunWithinInterceptionDecorationContextGenerator(classMethod, this) {

            @Override
            void doWork(CodeAttribute b, ClassMethod classMethod) {
                loadBeanInstance(classMethod.getClassFile(), methodInfo, b);
                //now we should have the target bean instance on top of the stack
                // we need to dup it so we still have it to compare to the return value
                b.dup();

                //lets create the method invocation
                String methodDescriptor = methodInfo.getDescriptor();
                b.loadMethodParameters();
                if (method.getDeclaringClass().isInterface()) {
                    b.invokeinterface(methodInfo.getDeclaringClass(), methodInfo.getName(), methodDescriptor);
                } else {
                    b.invokevirtual(methodInfo.getDeclaringClass(), methodInfo.getName(), methodDescriptor);
                }
            }

            @Override
            void doReturn(CodeAttribute b, ClassMethod classMethod) {
                // assumes doWork() result is on top of the stack
                // if this method returns a primitive we just return
                if (method.getReturnType().isPrimitive()) {
                    b.returnInstruction();
                } else {
                    // otherwise we have to check that the proxy is not returning 'this;
                    // now we need to check if the proxy has return 'this' and if so return
                    // an
                    // instance of the proxy.
                    // currently we have result, beanInstance on the stack.
                    b.dupX1();
                    // now we have result, beanInstance, result
                    // we need to compare result and beanInstance

                    // first we need to build up the inner conditional that just returns
                    // the
                    // result
                    final BranchEnd returnInstruction = b.ifAcmpeq();
                    b.returnInstruction();
                    b.branchEnd(returnInstruction);

                    // now add the case where the proxy returns 'this';
                    b.aload(0);
                    b.checkcast(methodInfo.getMethod().getReturnType().getName());
                    b.returnInstruction();
                }
            }
        }.runStartIfNotEmpty();
    }
1300691
public BenchmarkResult run() {
		final BenchmarkResult res = new BenchmarkResult(conf.getListener());
		BenchmarkExecutor.initialize(conf, res);

		// instantiate methods
		final Map<Class<?>, Object> instantiatedObjs = instantiateObjects(res);

		// getting Benchmarkables
		try {
			final List<BenchmarkElement> elements = getBenchmarkElements(instantiatedObjs);

			// arranging them
			final AbstractMethodArrangement arrangement = AbstractMethodArrangement
					.getMethodArrangement(elements, conf.getArrangement());

			// getting the mapping and executing beforemethod
			final Map<Class<?>, Object> objectsToExecute = executeBeforeBenchClass(
					instantiatedObjs, res);

			// executing the bench for the arrangement
			for (final BenchmarkElement elem : arrangement) {
				// invoking gc if possible
				if (RAN.nextDouble() < conf.getGcProb()) {
					System.gc();
				}

				final BenchmarkExecutor exec = BenchmarkExecutor
						.getExecutor(elem);

				final Object obj = objectsToExecute.get(elem.getMeth()
						.getMethodToBench().getDeclaringClass());
				// check needed because of failed initialization of objects
				if (obj != null) {
					exec.executeBeforeMethods(obj);
					exec.executeBench(obj, elem.getParameter());
					exec.executeAfterMethods(obj);
				}
			}

			// cleaning up methods to benchmark
			tearDownObjectsToExecute(objectsToExecute, res);
		} catch (PerfidixMethodCheckException exc) {
			res.addException(exc);
		}
		return res;
	}
518400
Object toMongoObject(final Object javaObj, final boolean includeClassName) {
        if (javaObj == null) {
            return null;
        }
        Class origClass = javaObj.getClass();

        if (origClass.isAnonymousClass() && origClass.getSuperclass().isEnum()) {
            origClass = origClass.getSuperclass();
        }

        final Object newObj = getConverters().encode(origClass, javaObj);
        if (newObj == null) {
            LOG.warn("converted " + javaObj + " to null");
            return null;
        }
        final Class type = newObj.getClass();
        final boolean bSameType = origClass.equals(type);

        //TODO: think about this logic a bit more.
        //Even if the converter changed it, should it still be processed?
        if (!bSameType && !(Map.class.isAssignableFrom(type) || Iterable.class.isAssignableFrom(type))) {
            return newObj;
        } else { //The converter ran, and produced another type, or it is a list/map

            boolean isSingleValue = true;
            boolean isMap = false;
            Class subType = null;

            if (type.isArray() || Map.class.isAssignableFrom(type) || Iterable.class.isAssignableFrom(type)) {
                isSingleValue = false;
                isMap = implementsInterface(type, Map.class);
                // subtype of Long[], List<Long> is Long
                subType = (type.isArray()) ? type.getComponentType() : getParameterizedClass(type, (isMap) ? 1 : 0);
            }

            if (isSingleValue && !isPropertyType(type)) {
                final DBObject dbObj = toDBObject(newObj);
                if (!includeClassName) {
                    dbObj.removeField(opts.getDiscriminatorField());
                }
                return dbObj;
            } else if (newObj instanceof DBObject) {
                return newObj;
            } else if (isMap) {
                if (isPropertyType(subType)) {
                    return toDBObject(newObj);
                } else {
                    final LinkedHashMap m = new LinkedHashMap();
                    for (final Map.Entry e : (Iterable<Map.Entry>) ((Map) newObj).entrySet()) {
                        m.put(e.getKey(), toMongoObject(e.getValue(), includeClassName));
                    }

                    return m;
                }
                //Set/List but needs elements converted
            } else if (!isSingleValue && !isPropertyType(subType)) {
                final List<Object> values = new BasicDBList();
                if (type.isArray()) {
                    for (final Object obj : (Object[]) newObj) {
                        values.add(toMongoObject(obj, includeClassName));
                    }
                } else {
                    for (final Object obj : (Iterable) newObj) {
                        values.add(toMongoObject(obj, includeClassName));
                    }
                }

                return values;
            } else {
                return newObj;
            }
        }
    }
211167
protected Object invoke(Bindings bindings, ELContext context, Object base, Method method)
		throws InvocationTargetException, IllegalAccessException {
		Class<?>[] types = method.getParameterTypes();
		Object[] params = null;
		if (types.length > 0) {
			params = new Object[types.length];
			if (varargs && method.isVarArgs()) {
				for (int i = 0; i < params.length - 1; i++) {
					Object param = getParam(i).eval(bindings, context);
					if (param != null || types[i].isPrimitive()) {
						params[i] = bindings.convert(param, types[i]);
					}
				}
				int varargIndex = types.length - 1;
				Class<?> varargType = types[varargIndex].getComponentType();
				int length = getParamCount() - varargIndex;
				Object array = null;
				if (length == 1) { // special: eventually use argument as is
					Object param = getParam(varargIndex).eval(bindings, context);
					if (param != null && param.getClass().isArray()) {
						if (types[varargIndex].isInstance(param)) {
							array = param;
						} else { // coerce array elements
							length = Array.getLength(param);
							array = Array.newInstance(varargType, length);
							for (int i = 0; i < length; i++) {
								Object elem = Array.get(param, i);
								if (elem != null || varargType.isPrimitive()) {
									Array.set(array, i, bindings.convert(elem, varargType));
								}
							}
						}
					} else { // single element array
						array = Array.newInstance(varargType, 1);
						if (param != null || varargType.isPrimitive()) {
							Array.set(array, 0, bindings.convert(param, varargType));
						}
					}
				} else {
					array = Array.newInstance(varargType, length);
					for (int i = 0; i < length; i++) {
						Object param = getParam(varargIndex + i).eval(bindings, context);
						if (param != null || varargType.isPrimitive()) {
							Array.set(array, i, bindings.convert(param, varargType));
						}
					}
				}
				params[varargIndex] = array;
			} else {
				for (int i = 0; i < params.length; i++) {
					Object param = getParam(i).eval(bindings, context);
					if (param != null || types[i].isPrimitive()) {
						params[i] = bindings.convert(param, types[i]);
					}
				}
			}
		}
		return method.invoke(base, params);
	}