/** * */ package com.mysema.codegen; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; /** * @author tiwe * * @param */ public final class MethodEvaluator implements Evaluator { private final Method method; private final Object object; private final Class projectionType; MethodEvaluator(Method method, Object object, Class projectionType) { this.method = method; this.object = object; this.projectionType = projectionType; } @SuppressWarnings("unchecked") @Override public T evaluate(Object... args) { try { return (T) method.invoke(object, args); } catch (IllegalAccessException e) { throw new IllegalArgumentException(e); } catch (InvocationTargetException e) { throw new IllegalArgumentException(e); } } @Override public Class getType() { return projectionType; } }