org.crsh.lang.impl.groovy
Class GroovyCompiler

java.lang.Object
  extended by org.crsh.lang.impl.groovy.GroovyCompiler
All Implemented Interfaces:
Compiler

public class GroovyCompiler
extends Object
implements Compiler

Author:
Julien Viet

Field Summary
private static Set<String> EXT
          .
(package private) static Logger log
          .
private  GroovyClassFactory<Object> objectGroovyClassFactory
          .
 
Constructor Summary
GroovyCompiler(PluginContext context)
           
 
Method Summary
 CommandResolution compileCommand(String name, byte[] source)
          Compile a command..
 String doCallBack(ShellSession session, String name, String defaultValue)
           
private  String eval(ShellSession session, String name, String def)
           
 Set<String> getExtensions()
          Returns the set of extensions managed by this implementation.
static groovy.lang.GroovyShell getGroovyShell(ShellSession session)
          The underlying groovu shell used for the REPL.
private
<C extends BaseCommand>
ClassShellCommand<C>
make(Class<C> clazz)
           
private
<C extends GroovyScriptCommand>
GroovyScriptShellCommand<C>
make2(Class<C> clazz)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

static final Logger log
.


EXT

private static final Set<String> EXT
.


objectGroovyClassFactory

private GroovyClassFactory<Object> objectGroovyClassFactory
.

Constructor Detail

GroovyCompiler

public GroovyCompiler(PluginContext context)
Method Detail

getExtensions

public Set<String> getExtensions()
Description copied from interface: Compiler
Returns the set of extensions managed by this implementation.

Specified by:
getExtensions in interface Compiler
Returns:
the set of extensions, for instance ("groovy")

doCallBack

public String doCallBack(ShellSession session,
                         String name,
                         String defaultValue)
Specified by:
doCallBack in interface Compiler

getGroovyShell

public static groovy.lang.GroovyShell getGroovyShell(ShellSession session)
The underlying groovu shell used for the REPL.

Returns:
a groovy shell operating on the session attributes

eval

private String eval(ShellSession session,
                    String name,
                    String def)

compileCommand

public CommandResolution compileCommand(String name,
                                        byte[] source)
                                 throws CommandException,
                                        NullPointerException
Description copied from interface: Compiler
Compile a command..

Specified by:
compileCommand in interface Compiler
Parameters:
name - the command name
source - the command source @return the command or null if no command can be resolved
Throws:
CommandException - when the command exists but cannot be created
NullPointerException - if the command name is null

make

private <C extends BaseCommand> ClassShellCommand<C> make(Class<C> clazz)
                                               throws IntrospectionException
Throws:
IntrospectionException

make2

private <C extends GroovyScriptCommand> GroovyScriptShellCommand<C> make2(Class<C> clazz)
                                                               throws IntrospectionException
Throws:
IntrospectionException


Copyright © 2015 eXo Platform SAS. All Rights Reserved.