Package org.codehaus.janino

Examples of org.codehaus.janino.ClassBodyEvaluator


  public Condition build(String script) throws IllegalAccessException,
      CompileException, ParseException, ScanException, InstantiationException,
      SecurityException, NoSuchMethodException, IllegalArgumentException,
      InvocationTargetException {

    ClassBodyEvaluator cbe = new ClassBodyEvaluator();
    cbe.setImplementedTypes(new Class[] { Condition.class });
    cbe.setExtendedType(MapWrapperForScripts.class);
    cbe.cook(SCRIPT_PREFIX + script + SCRIPT_SUFFIX);

    Class<?> clazz = cbe.getClazz();
    Condition instance = (Condition) clazz.newInstance();
    Method setMapMethod = clazz.getMethod("setMap", Map.class);
    setMapMethod.invoke(instance, context.getCopyOfPropertyMap());

    Method setNameMethod = clazz.getMethod("setName", String.class);
View Full Code Here


          CompileException,
          InstantiationException,
          SecurityException, NoSuchMethodException, IllegalArgumentException,
          InvocationTargetException {

    ClassBodyEvaluator cbe = new ClassBodyEvaluator();
    cbe.setImplementedInterfaces(new Class[]{Condition.class});
    cbe.setExtendedClass(PropertyWrapperForScripts.class);
    cbe.cook(SCRIPT_PREFIX + script + SCRIPT_SUFFIX);

    Class<?> clazz = cbe.getClazz();
    Condition instance = (Condition) clazz.newInstance();
    Method setMapMethod = clazz.getMethod("setPropertyContainers", PropertyContainer.class, PropertyContainer.class);
    setMapMethod.invoke(instance, localPropContainer, context);

    return instance;
View Full Code Here

          CompileException,
          InstantiationException,
          SecurityException, NoSuchMethodException, IllegalArgumentException,
          InvocationTargetException {

    ClassBodyEvaluator cbe = new ClassBodyEvaluator();
    cbe.setImplementedInterfaces(new Class[]{Condition.class});
    cbe.setExtendedClass(PropertyWrapperForScripts.class);
    cbe.cook(SCRIPT_PREFIX + script + SCRIPT_SUFFIX);

    Class<?> clazz = cbe.getClazz();
    Condition instance = (Condition) clazz.newInstance();
    Method setMapMethod = clazz.getMethod("setPropertyContainers", PropertyContainer.class, PropertyContainer.class);
    setMapMethod.invoke(instance, localPropContainer, context);

    return instance;
View Full Code Here

          CompileException,
          InstantiationException,
          SecurityException, NoSuchMethodException, IllegalArgumentException,
          InvocationTargetException {

    ClassBodyEvaluator cbe = new ClassBodyEvaluator();
    cbe.setImplementedInterfaces(new Class[]{Condition.class});
    cbe.setExtendedClass(PropertyWrapperForScripts.class);
    cbe.setParentClassLoader(ClassBodyEvaluator.class.getClassLoader());
    cbe.cook(SCRIPT_PREFIX + script + SCRIPT_SUFFIX);

    Class<?> clazz = cbe.getClazz();
    Condition instance = (Condition) clazz.newInstance();
    Method setMapMethod = clazz.getMethod("setPropertyContainers", PropertyContainer.class, PropertyContainer.class);
    setMapMethod.invoke(instance, localPropContainer, context);

    return instance;
View Full Code Here

  public Condition build(String script) throws IllegalAccessException,
          CompileException, ParseException, ScanException, InstantiationException,
          SecurityException, NoSuchMethodException, IllegalArgumentException,
          InvocationTargetException {

    ClassBodyEvaluator cbe = new ClassBodyEvaluator();
    cbe.setImplementedTypes(new Class[]{Condition.class});
    cbe.setExtendedType(PropertyWrapperForScripts.class);
    cbe.cook(SCRIPT_PREFIX + script + SCRIPT_SUFFIX);

    Class<?> clazz = cbe.getClazz();
    Condition instance = (Condition) clazz.newInstance();
    Method setMapMethod = clazz.getMethod("setPropertyContainers", PropertyContainer.class, PropertyContainer.class);
    setMapMethod.invoke(instance, localPropContainer, context);

    return instance;
View Full Code Here

          }
        }

      StringReader stringReader = new StringReader( buf.toString() );
      ClassLoader classLoader = JaninoFactory.class.getClassLoader();
      ClassBodyEvaluator evaluator = new ClassBodyEvaluator( new Scanner( null, stringReader ), abstractClass, new Class[ 0 ], classLoader );

      cachedTargetType = evaluator.getClazz();
      targetType = cachedTargetType;
      }
    else
      targetType = cachedTargetType;
View Full Code Here

TOP

Related Classes of org.codehaus.janino.ClassBodyEvaluator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.