|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pig.scripting.jruby.PigJrubyLibrary
public class PigJrubyLibrary
This class provides the ability to present to Ruby a library that was written in Java. In JRuby, there are two ways to present a library to ruby: one is to implement it in ruby as a module or class, and the other is to implement it in Java and then register it with the runtime. For the Pig datatypes we provide Ruby implementations for, it was easier to implement them in Java and provide a Ruby interface via the annotations that Jruby provides. Additionally, this class provides static object conversion functionality to and from Pig and JRuby.
Constructor Summary | |
---|---|
PigJrubyLibrary()
|
Method Summary | ||
---|---|---|
static org.jruby.runtime.builtin.IRubyObject |
enumeratorize(org.jruby.Ruby runtime,
org.jruby.runtime.builtin.IRubyObject obj,
String name)
This is a hack to get around the fact that in JRuby 1.6.7, the enumeratorize method isn't public. |
|
void |
load(org.jruby.Ruby runtime,
boolean wrap)
This method is called from JRuby to register any classes in the library. |
|
static org.jruby.RubyBoolean |
pigToRuby(org.jruby.Ruby ruby,
Boolean object)
A type specific conversion routine. |
|
static RubyDataBag |
pigToRuby(org.jruby.Ruby ruby,
DataBag object)
A type specific conversion routine. |
|
static RubyDataByteArray |
pigToRuby(org.jruby.Ruby ruby,
DataByteArray object)
A type specific conversion routine. |
|
static org.jruby.RubyFloat |
pigToRuby(org.jruby.Ruby ruby,
Double object)
A type specific conversion routine. |
|
static org.jruby.RubyFloat |
pigToRuby(org.jruby.Ruby ruby,
Float object)
A type specific conversion routine. |
|
static org.jruby.RubyFixnum |
pigToRuby(org.jruby.Ruby ruby,
Integer object)
A type specific conversion routine. |
|
static org.jruby.RubyFixnum |
pigToRuby(org.jruby.Ruby ruby,
Long object)
A type specific conversion routine. |
|
static
|
pigToRuby(org.jruby.Ruby ruby,
Map<T,?> object)
A type specific conversion routine for Pig Maps. |
|
static org.jruby.runtime.builtin.IRubyObject |
pigToRuby(org.jruby.Ruby ruby,
Object object)
This is the method which provides conversion from Pig to Ruby. |
|
static RubySchema |
pigToRuby(org.jruby.Ruby ruby,
Schema object)
A type specific conversion routine. |
|
static org.jruby.RubyString |
pigToRuby(org.jruby.Ruby ruby,
String object)
A type specific conversion routine. |
|
static org.jruby.RubyArray |
pigToRuby(org.jruby.Ruby ruby,
Tuple object)
A type specific conversion routine. |
|
static Object |
rubyToPig(org.jruby.runtime.builtin.IRubyObject rbObject)
This method facilitates conversion from Ruby objects to Pig objects. |
|
static Tuple |
rubyToPig(org.jruby.RubyArray rbObject)
A type specific conversion routine. |
|
static Long |
rubyToPig(org.jruby.RubyBignum rbObject)
A type specific conversion routine. |
|
static Boolean |
rubyToPig(org.jruby.RubyBoolean rbObject)
A type specific conversion routine. |
|
static DataBag |
rubyToPig(RubyDataBag rbObject)
A type specific conversion routine. |
|
static DataByteArray |
rubyToPig(RubyDataByteArray rbObject)
A type specific conversion routine. |
|
static Long |
rubyToPig(org.jruby.RubyFixnum rbObject)
A type specific conversion routine. |
|
static Double |
rubyToPig(org.jruby.RubyFloat rbObject)
A type specific conversion routine. |
|
static Map<String,?> |
rubyToPig(org.jruby.RubyHash rbObject)
A type specific conversion routine. |
|
static Integer |
rubyToPig(org.jruby.RubyInteger rbObject)
A type specific conversion routine. |
|
static Object |
rubyToPig(org.jruby.RubyNil rbObject)
A type specific conversion routine. |
|
static Schema |
rubyToPig(RubySchema rbObject)
A type specific conversion routine. |
|
static String |
rubyToPig(org.jruby.RubyString rbObject)
A type specific conversion routine. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PigJrubyLibrary()
Method Detail |
---|
public void load(org.jruby.Ruby runtime, boolean wrap) throws IOException
load
in interface org.jruby.runtime.load.Library
runtime
- the current Ruby runtimewrap
- ignored
IOException
public static Object rubyToPig(org.jruby.runtime.builtin.IRubyObject rbObject) throws ExecException
rbObject
- a Ruby object to convert
ExecException
- if rbObject is not of a known type that can be convertedpublic static Tuple rubyToPig(org.jruby.RubyArray rbObject) throws ExecException
rbObject
- object to convert
ExecException
public static Map<String,?> rubyToPig(org.jruby.RubyHash rbObject) throws ExecException
rbObject
- object to convert
ExecException
public static Boolean rubyToPig(org.jruby.RubyBoolean rbObject)
rbObject
- object to convert
public static Schema rubyToPig(RubySchema rbObject)
rbObject
- object to convert
public static String rubyToPig(org.jruby.RubyString rbObject)
rbObject
- object to convert
public static Long rubyToPig(org.jruby.RubyBignum rbObject)
rbObject
- object to convert
public static Long rubyToPig(org.jruby.RubyFixnum rbObject)
rbObject
- object to convert
public static Double rubyToPig(org.jruby.RubyFloat rbObject)
rbObject
- object to convert
public static Integer rubyToPig(org.jruby.RubyInteger rbObject)
rbObject
- object to convert
public static DataBag rubyToPig(RubyDataBag rbObject)
rbObject
- object to convert
public static DataByteArray rubyToPig(RubyDataByteArray rbObject)
rbObject
- object to convert
public static Object rubyToPig(org.jruby.RubyNil rbObject)
rbObject
- object to convert
public static org.jruby.runtime.builtin.IRubyObject pigToRuby(org.jruby.Ruby ruby, Object object) throws ExecException
ruby
- the Ruby runtime to create objects inobject
- the Pig object to convert to Ruby
ExecException
- object is not a convertible Pig typepublic static org.jruby.RubyArray pigToRuby(org.jruby.Ruby ruby, Tuple object) throws ExecException
ruby
- the Ruby runtime to create objects inobject
- object to convert
ExecException
- object contained an object that could not convertpublic static org.jruby.RubyBoolean pigToRuby(org.jruby.Ruby ruby, Boolean object)
ruby
- the Ruby runtime to create objects inobject
- object to convert
public static RubyDataBag pigToRuby(org.jruby.Ruby ruby, DataBag object)
ruby
- the Ruby runtime to create objects inobject
- object to convert
public static RubySchema pigToRuby(org.jruby.Ruby ruby, Schema object)
ruby
- the Ruby runtime to create objects inobject
- object to convert
public static <T> org.jruby.RubyHash pigToRuby(org.jruby.Ruby ruby, Map<T,?> object) throws ExecException
ruby
- the Ruby runtime to create objects inobject
- map to convert. In Pig, only maps with String keys are
supported
ExecException
- object contains a key that can't be convert to a Ruby typepublic static RubyDataByteArray pigToRuby(org.jruby.Ruby ruby, DataByteArray object)
ruby
- the Ruby runtime to create objects inobject
- object to convert
public static org.jruby.RubyString pigToRuby(org.jruby.Ruby ruby, String object)
ruby
- the Ruby runtime to create objects inobject
- object to convert
public static org.jruby.RubyFixnum pigToRuby(org.jruby.Ruby ruby, Integer object)
ruby
- the Ruby runtime to create objects inobject
- object to convert
public static org.jruby.RubyFixnum pigToRuby(org.jruby.Ruby ruby, Long object)
ruby
- the Ruby runtime to create objects inobject
- object to convert
public static org.jruby.RubyFloat pigToRuby(org.jruby.Ruby ruby, Float object)
ruby
- the Ruby runtime to create objects inobject
- object to convert
public static org.jruby.RubyFloat pigToRuby(org.jruby.Ruby ruby, Double object)
ruby
- the Ruby runtime to create objects inobject
- object to convert
public static org.jruby.runtime.builtin.IRubyObject enumeratorize(org.jruby.Ruby runtime, org.jruby.runtime.builtin.IRubyObject obj, String name)
runtime
- the Ruby runtime to create objects inobj
- the Enumerable object to wrapname
- the name of the method that still needs a block (ie each or flatten)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |