public abstract class JRubyScriptUtils
extends java.lang.Object
As of Spring 3.0, this class requires JRuby 1.1 or higher.
Modifier and Type | Class and Description |
---|---|
static class |
JRubyScriptUtils.JRubyExecutionException
Exception thrown in response to a JRuby
RaiseException
being thrown from a JRuby method invocation. |
private static class |
JRubyScriptUtils.RubyObjectInvocationHandler
InvocationHandler that invokes a JRuby script method.
|
Constructor and Description |
---|
JRubyScriptUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Object |
createJRubyObject(java.lang.String scriptSource,
java.lang.Class<?>... interfaces)
Create a new JRuby-scripted object from the given script source,
using the default
ClassLoader . |
static java.lang.Object |
createJRubyObject(java.lang.String scriptSource,
java.lang.Class<?>[] interfaces,
java.lang.ClassLoader classLoader)
Create a new JRuby-scripted object from the given script source.
|
private static java.lang.String |
findClassName(Node rootNode)
Given the root
Node in a JRuby AST will locate the name of the
class defined by that AST. |
private static ClassNode |
findClassNode(Node node)
Find the first
ClassNode under the supplied Node . |
private static Ruby |
initializeRuntime()
Initializes an instance of the
org.jruby.Ruby runtime. |
public static java.lang.Object createJRubyObject(java.lang.String scriptSource, java.lang.Class<?>... interfaces) throws JumpException
ClassLoader
.scriptSource
- the script source textinterfaces
- the interfaces that the scripted Java object is to implementJumpException
- in case of JRuby parsing failureClassUtils.getDefaultClassLoader()
public static java.lang.Object createJRubyObject(java.lang.String scriptSource, java.lang.Class<?>[] interfaces, java.lang.ClassLoader classLoader)
scriptSource
- the script source textinterfaces
- the interfaces that the scripted Java object is to implementclassLoader
- the ClassLoader
to create the script proxy withJumpException
- in case of JRuby parsing failureprivate static Ruby initializeRuntime()
org.jruby.Ruby
runtime.private static java.lang.String findClassName(Node rootNode)
Node
in a JRuby AST will locate the name of the
class defined by that AST.java.lang.IllegalArgumentException
- if no class is defined by the supplied ASTprivate static ClassNode findClassNode(Node node)
ClassNode
under the supplied Node
.ClassNode
, or null
if none found