public <T>T createLambda(String code,TypeReference<T> typeReference) throws LambdaCreationException {
  String helperClassSource=helperProvider.getHelperClassSource(typeReference.toString(),code,imports,staticImports);
  try {
    Class<?> helperClass=classFactory.createClass(helperProvider.getHelperClassName(),helperClassSource,javaCompiler,createOptionsForCompilationClasspath(compilationClassPath),parentClassLoader);
    Method lambdaReturningMethod=helperClass.getMethod(helperProvider.getLambdaReturningMethodName());
    @SuppressWarnings("unchecked") T lambda=(T)lambdaReturningMethod.invoke(null);
    return lambda;
  }
 catch (  ReflectiveOperationException|RuntimeException|NoClassDefFoundError e) {
    throw new LambdaCreationException(e);
  }
catch (  ClassCompilationException classCompilationException) {
    throw new LambdaCreationException(classCompilationException);
  }
}

public < T > T createLambda ( String code , TypeReference < T > typeReference ) throws LambdaCreationException { String helperClassSource = helperProvider . getHelperClassSource ( typeReference . toString ( ) , code , imports , staticImports ) ; try { Class < ? > helperClass = classFactory . createClass ( helperProvider . getHelperClassName ( ) , helperClassSource , javaCompiler , createOptionsForCompilationClasspath ( compilationClassPath ) , parentClassLoader ) ; Method lambdaReturningMethod = helperClass . getMethod ( helperProvider . getLambdaReturningMethodName ( ) ) ; @ SuppressWarnings ( "unchecked" ) T lambda = ( T ) lambdaReturningMethod . invoke ( null ) ; return lambda ; } catch ( ReflectiveOperationException | RuntimeException | NoClassDefFoundError e ) { throw new LambdaCreationException ( e ) ; } catch ( ClassCompilationException classCompilationException ) { throw new LambdaCreationException ( classCompilationException ) ; } }
creates lambda from the given code .
