org.jruby.javasupport
Class JavaUtil

java.lang.Object
  extended by org.jruby.javasupport.JavaUtil

public class JavaUtil
extends java.lang.Object


Nested Class Summary
static class JavaUtil.JavaConverter
           
static interface JavaUtil.NumericConverter
           
static interface JavaUtil.RubyConverter
          Deprecated. 
 
Field Summary
static JavaUtil.RubyConverter ARRAY_BIGDECIMAL_CONVERTER
          Deprecated. 
static JavaUtil.RubyConverter ARRAY_BIGINTEGER_CONVERTER
          Deprecated. 
static JavaUtil.RubyConverter ARRAY_BOOLEAN_CONVERTER
          Deprecated. 
static JavaUtil.RubyConverter ARRAY_BYTE_CONVERTER
          Deprecated. 
static JavaUtil.RubyConverter ARRAY_CHAR_CONVERTER
          Deprecated. 
static JavaUtil.RubyConverter ARRAY_CLASS_CONVERTER
          Deprecated. 
static java.util.Map<java.lang.Class,JavaUtil.RubyConverter> ARRAY_CONVERTERS
          Deprecated. 
static JavaUtil.RubyConverter ARRAY_DOUBLE_CONVERTER
          Deprecated. 
static JavaUtil.RubyConverter ARRAY_FLOAT_CONVERTER
          Deprecated. 
static JavaUtil.RubyConverter ARRAY_INT_CONVERTER
          Deprecated. 
static JavaUtil.RubyConverter ARRAY_LONG_CONVERTER
          Deprecated. 
static JavaUtil.RubyConverter ARRAY_OBJECT_CONVERTER
          Deprecated. 
static JavaUtil.RubyConverter ARRAY_SHORT_CONVERTER
          Deprecated. 
static JavaUtil.RubyConverter ARRAY_STRING_CONVERTER
          Deprecated. 
static JavaUtil.RubyConverter RUBY_BOOLEAN_CONVERTER
          Deprecated. 
static JavaUtil.RubyConverter RUBY_BYTE_CONVERTER
          Deprecated. 
static JavaUtil.RubyConverter RUBY_CHAR_CONVERTER
          Deprecated. 
static java.util.Map<java.lang.Class,JavaUtil.RubyConverter> RUBY_CONVERTERS
          Deprecated. 
static JavaUtil.RubyConverter RUBY_DOUBLE_CONVERTER
          Deprecated. 
static JavaUtil.RubyConverter RUBY_FLOAT_CONVERTER
          Deprecated. 
static JavaUtil.RubyConverter RUBY_INTEGER_CONVERTER
          Deprecated. 
static JavaUtil.RubyConverter RUBY_LONG_CONVERTER
          Deprecated. 
static JavaUtil.RubyConverter RUBY_SHORT_CONVERTER
          Deprecated. 
 
Constructor Summary
JavaUtil()
           
 
Method Summary
static java.lang.Object coerceJavaObjectToType(ThreadContext context, java.lang.Object javaObject, java.lang.Class target)
           
static java.lang.Object coerceNilToType(RubyNil nil, java.lang.Class target)
          Deprecated. 
static java.lang.Object coerceOtherToType(ThreadContext context, IRubyObject arg, java.lang.Class target)
           
static java.lang.Object coerceStringToType(RubyString string, java.lang.Class target)
           
static java.lang.Object convertArgument(Ruby runtime, java.lang.Object argument, java.lang.Class<?> parameterType)
          Deprecated. 
static java.lang.Object convertArgumentToType(ThreadContext context, IRubyObject arg, java.lang.Class target)
          Deprecated. 
static IRubyObject convertJavaArrayElementToRuby(Ruby runtime, JavaUtil.JavaConverter converter, java.lang.Object array, int i)
           
static IRubyObject[] convertJavaArrayToRuby(Ruby runtime, java.lang.Object[] objects)
           
static IRubyObject convertJavaToRuby(Ruby runtime, boolean b)
          Deprecated. 
static IRubyObject convertJavaToRuby(Ruby runtime, double d)
          Deprecated. 
static IRubyObject convertJavaToRuby(Ruby runtime, float f)
          Deprecated. 
static IRubyObject convertJavaToRuby(Ruby runtime, int i)
          Deprecated. 
static IRubyObject convertJavaToRuby(Ruby runtime, JavaUtil.JavaConverter converter, java.lang.Object object)
          Deprecated. 
static IRubyObject convertJavaToRuby(Ruby runtime, long l)
          Deprecated. 
static IRubyObject convertJavaToRuby(Ruby runtime, java.lang.Object object)
           
static IRubyObject convertJavaToRuby(Ruby runtime, java.lang.Object object, java.lang.Class javaClass)
           
static IRubyObject convertJavaToUsableRubyObject(Ruby runtime, java.lang.Object object)
          Returns a usable RubyObject; for types that are not converted to Ruby native types, a Java proxy will be returned.
static IRubyObject convertJavaToUsableRubyObjectWithConverter(Ruby runtime, java.lang.Object object, JavaUtil.JavaConverter converter)
           
static java.lang.Object convertProcToInterface(ThreadContext context, RubyObject rubyObject, java.lang.Class target)
           
static java.lang.Object convertRubyToJava(IRubyObject rubyObject)
          Deprecated. 
static java.lang.Object convertRubyToJava(IRubyObject rubyObject, java.lang.Class javaClass)
          Deprecated. 
static boolean convertRubyToJavaBoolean(IRubyObject rubyObject)
          Deprecated. 
static byte convertRubyToJavaByte(IRubyObject rubyObject)
          Deprecated. 
static char convertRubyToJavaChar(IRubyObject rubyObject)
          Deprecated. 
static double convertRubyToJavaDouble(IRubyObject rubyObject)
          Deprecated. 
static float convertRubyToJavaFloat(IRubyObject rubyObject)
          Deprecated. 
static int convertRubyToJavaInt(IRubyObject rubyObject)
          Deprecated. 
static long convertRubyToJavaLong(IRubyObject rubyObject)
          Deprecated. 
static short convertRubyToJavaShort(IRubyObject rubyObject)
          Deprecated. 
static JavaUtil.RubyConverter getArrayConverter(java.lang.Class type)
          Deprecated. 
static java.lang.String getJavaCasedName(java.lang.String javaCasedName)
           
static JavaUtil.JavaConverter getJavaConverter(java.lang.Class clazz)
           
static java.lang.String getJavaPropertyName(java.lang.String beanMethodName)
           
static JavaUtil.NumericConverter getNumericConverter(java.lang.Class target)
           
static java.lang.String getRubyCasedName(java.lang.String javaCasedName)
           
static java.util.Set<java.lang.String> getRubyNamesForJavaName(java.lang.String javaName, java.util.List<java.lang.reflect.Method> methods)
          Given a simple Java method name and the Java Method objects that represent all its overloads, add to the given nameSet all possible Ruby names that would be valid.
static boolean isDuckTypeConvertable(java.lang.Class providedArgumentType, java.lang.Class parameterType)
           
static boolean isJavaObject(IRubyObject candidate)
           
static IRubyObject java_to_primitive(IRubyObject recv, IRubyObject object, Block unusedBlock)
          Deprecated. 
static IRubyObject java_to_ruby(Ruby runtime, IRubyObject object)
          Deprecated. 
static IRubyObject primitive_to_java(IRubyObject recv, IRubyObject object, Block unusedBlock)
          Deprecated. 
static java.lang.Class<?> primitiveToWrapper(java.lang.Class<?> type)
           
static IRubyObject ruby_to_java(IRubyObject recv, IRubyObject object, Block unusedBlock)
          Deprecated. 
static java.lang.Object unwrapJavaObject(IRubyObject object)
           
static JavaObject unwrapJavaObject(Ruby runtime, IRubyObject convertee, java.lang.String errorMessage)
           
static java.lang.Object unwrapJavaValue(Ruby runtime, IRubyObject obj, java.lang.String errorMessage)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RUBY_BOOLEAN_CONVERTER

@Deprecated
public static final JavaUtil.RubyConverter RUBY_BOOLEAN_CONVERTER
Deprecated. 

RUBY_BYTE_CONVERTER

@Deprecated
public static final JavaUtil.RubyConverter RUBY_BYTE_CONVERTER
Deprecated. 

RUBY_SHORT_CONVERTER

@Deprecated
public static final JavaUtil.RubyConverter RUBY_SHORT_CONVERTER
Deprecated. 

RUBY_CHAR_CONVERTER

@Deprecated
public static final JavaUtil.RubyConverter RUBY_CHAR_CONVERTER
Deprecated. 

RUBY_INTEGER_CONVERTER

@Deprecated
public static final JavaUtil.RubyConverter RUBY_INTEGER_CONVERTER
Deprecated. 

RUBY_LONG_CONVERTER

@Deprecated
public static final JavaUtil.RubyConverter RUBY_LONG_CONVERTER
Deprecated. 

RUBY_FLOAT_CONVERTER

@Deprecated
public static final JavaUtil.RubyConverter RUBY_FLOAT_CONVERTER
Deprecated. 

RUBY_DOUBLE_CONVERTER

@Deprecated
public static final JavaUtil.RubyConverter RUBY_DOUBLE_CONVERTER
Deprecated. 

RUBY_CONVERTERS

@Deprecated
public static final java.util.Map<java.lang.Class,JavaUtil.RubyConverter> RUBY_CONVERTERS
Deprecated. 

ARRAY_BOOLEAN_CONVERTER

@Deprecated
public static final JavaUtil.RubyConverter ARRAY_BOOLEAN_CONVERTER
Deprecated. 

ARRAY_BYTE_CONVERTER

@Deprecated
public static final JavaUtil.RubyConverter ARRAY_BYTE_CONVERTER
Deprecated. 

ARRAY_SHORT_CONVERTER

@Deprecated
public static final JavaUtil.RubyConverter ARRAY_SHORT_CONVERTER
Deprecated. 

ARRAY_CHAR_CONVERTER

@Deprecated
public static final JavaUtil.RubyConverter ARRAY_CHAR_CONVERTER
Deprecated. 

ARRAY_INT_CONVERTER

@Deprecated
public static final JavaUtil.RubyConverter ARRAY_INT_CONVERTER
Deprecated. 

ARRAY_LONG_CONVERTER

@Deprecated
public static final JavaUtil.RubyConverter ARRAY_LONG_CONVERTER
Deprecated. 

ARRAY_FLOAT_CONVERTER

@Deprecated
public static final JavaUtil.RubyConverter ARRAY_FLOAT_CONVERTER
Deprecated. 

ARRAY_DOUBLE_CONVERTER

@Deprecated
public static final JavaUtil.RubyConverter ARRAY_DOUBLE_CONVERTER
Deprecated. 

ARRAY_OBJECT_CONVERTER

@Deprecated
public static final JavaUtil.RubyConverter ARRAY_OBJECT_CONVERTER
Deprecated. 

ARRAY_CLASS_CONVERTER

@Deprecated
public static final JavaUtil.RubyConverter ARRAY_CLASS_CONVERTER
Deprecated. 

ARRAY_STRING_CONVERTER

@Deprecated
public static final JavaUtil.RubyConverter ARRAY_STRING_CONVERTER
Deprecated. 

ARRAY_BIGINTEGER_CONVERTER

@Deprecated
public static final JavaUtil.RubyConverter ARRAY_BIGINTEGER_CONVERTER
Deprecated. 

ARRAY_BIGDECIMAL_CONVERTER

@Deprecated
public static final JavaUtil.RubyConverter ARRAY_BIGDECIMAL_CONVERTER
Deprecated. 

ARRAY_CONVERTERS

@Deprecated
public static final java.util.Map<java.lang.Class,JavaUtil.RubyConverter> ARRAY_CONVERTERS
Deprecated. 
Constructor Detail

JavaUtil

public JavaUtil()
Method Detail

convertJavaArrayToRuby

public static IRubyObject[] convertJavaArrayToRuby(Ruby runtime,
                                                   java.lang.Object[] objects)

getJavaConverter

public static JavaUtil.JavaConverter getJavaConverter(java.lang.Class clazz)

convertJavaToRuby

public static IRubyObject convertJavaToRuby(Ruby runtime,
                                            java.lang.Object object)

convertJavaToRuby

public static IRubyObject convertJavaToRuby(Ruby runtime,
                                            java.lang.Object object,
                                            java.lang.Class javaClass)

convertJavaToUsableRubyObject

public static IRubyObject convertJavaToUsableRubyObject(Ruby runtime,
                                                        java.lang.Object object)
Returns a usable RubyObject; for types that are not converted to Ruby native types, a Java proxy will be returned.

Parameters:
runtime -
object -
Returns:
corresponding Ruby type, or a functional Java proxy

convertJavaToUsableRubyObjectWithConverter

public static IRubyObject convertJavaToUsableRubyObjectWithConverter(Ruby runtime,
                                                                     java.lang.Object object,
                                                                     JavaUtil.JavaConverter converter)

convertJavaArrayElementToRuby

public static IRubyObject convertJavaArrayElementToRuby(Ruby runtime,
                                                        JavaUtil.JavaConverter converter,
                                                        java.lang.Object array,
                                                        int i)

primitiveToWrapper

public static java.lang.Class<?> primitiveToWrapper(java.lang.Class<?> type)

isDuckTypeConvertable

public static boolean isDuckTypeConvertable(java.lang.Class providedArgumentType,
                                            java.lang.Class parameterType)

convertProcToInterface

public static java.lang.Object convertProcToInterface(ThreadContext context,
                                                      RubyObject rubyObject,
                                                      java.lang.Class target)

coerceJavaObjectToType

public static java.lang.Object coerceJavaObjectToType(ThreadContext context,
                                                      java.lang.Object javaObject,
                                                      java.lang.Class target)

getNumericConverter

public static JavaUtil.NumericConverter getNumericConverter(java.lang.Class target)

coerceStringToType

public static java.lang.Object coerceStringToType(RubyString string,
                                                  java.lang.Class target)

coerceOtherToType

public static java.lang.Object coerceOtherToType(ThreadContext context,
                                                 IRubyObject arg,
                                                 java.lang.Class target)

isJavaObject

public static boolean isJavaObject(IRubyObject candidate)

unwrapJavaObject

public static java.lang.Object unwrapJavaObject(IRubyObject object)

unwrapJavaObject

public static JavaObject unwrapJavaObject(Ruby runtime,
                                          IRubyObject convertee,
                                          java.lang.String errorMessage)

unwrapJavaValue

public static java.lang.Object unwrapJavaValue(Ruby runtime,
                                               IRubyObject obj,
                                               java.lang.String errorMessage)

getJavaPropertyName

public static java.lang.String getJavaPropertyName(java.lang.String beanMethodName)

getRubyCasedName

public static java.lang.String getRubyCasedName(java.lang.String javaCasedName)

getJavaCasedName

public static java.lang.String getJavaCasedName(java.lang.String javaCasedName)

getRubyNamesForJavaName

public static java.util.Set<java.lang.String> getRubyNamesForJavaName(java.lang.String javaName,
                                                                      java.util.List<java.lang.reflect.Method> methods)
Given a simple Java method name and the Java Method objects that represent all its overloads, add to the given nameSet all possible Ruby names that would be valid.

Parameters:
simpleName -
nameSet -
methods -

convertRubyToJava

@Deprecated
public static java.lang.Object convertRubyToJava(IRubyObject rubyObject)
Deprecated. 


convertRubyToJava

@Deprecated
public static java.lang.Object convertRubyToJava(IRubyObject rubyObject,
                                                            java.lang.Class javaClass)
Deprecated. 


convertRubyToJavaByte

@Deprecated
public static byte convertRubyToJavaByte(IRubyObject rubyObject)
Deprecated. 


convertRubyToJavaShort

@Deprecated
public static short convertRubyToJavaShort(IRubyObject rubyObject)
Deprecated. 


convertRubyToJavaChar

@Deprecated
public static char convertRubyToJavaChar(IRubyObject rubyObject)
Deprecated. 


convertRubyToJavaInt

@Deprecated
public static int convertRubyToJavaInt(IRubyObject rubyObject)
Deprecated. 


convertRubyToJavaLong

@Deprecated
public static long convertRubyToJavaLong(IRubyObject rubyObject)
Deprecated. 


convertRubyToJavaFloat

@Deprecated
public static float convertRubyToJavaFloat(IRubyObject rubyObject)
Deprecated. 


convertRubyToJavaDouble

@Deprecated
public static double convertRubyToJavaDouble(IRubyObject rubyObject)
Deprecated. 


convertRubyToJavaBoolean

@Deprecated
public static boolean convertRubyToJavaBoolean(IRubyObject rubyObject)
Deprecated. 


convertArgumentToType

@Deprecated
public static java.lang.Object convertArgumentToType(ThreadContext context,
                                                                IRubyObject arg,
                                                                java.lang.Class target)
Deprecated. 


coerceNilToType

@Deprecated
public static java.lang.Object coerceNilToType(RubyNil nil,
                                                          java.lang.Class target)
Deprecated. 


convertJavaToRuby

@Deprecated
public static IRubyObject convertJavaToRuby(Ruby runtime,
                                                       int i)
Deprecated. 


convertJavaToRuby

@Deprecated
public static IRubyObject convertJavaToRuby(Ruby runtime,
                                                       long l)
Deprecated. 


convertJavaToRuby

@Deprecated
public static IRubyObject convertJavaToRuby(Ruby runtime,
                                                       float f)
Deprecated. 


convertJavaToRuby

@Deprecated
public static IRubyObject convertJavaToRuby(Ruby runtime,
                                                       double d)
Deprecated. 


convertJavaToRuby

@Deprecated
public static IRubyObject convertJavaToRuby(Ruby runtime,
                                                       boolean b)
Deprecated. 


convertJavaToRuby

@Deprecated
public static IRubyObject convertJavaToRuby(Ruby runtime,
                                                       JavaUtil.JavaConverter converter,
                                                       java.lang.Object object)
Deprecated. 


getArrayConverter

@Deprecated
public static JavaUtil.RubyConverter getArrayConverter(java.lang.Class type)
Deprecated. 


ruby_to_java

@Deprecated
public static IRubyObject ruby_to_java(IRubyObject recv,
                                                  IRubyObject object,
                                                  Block unusedBlock)
Deprecated. 

High-level object conversion utility.


java_to_primitive

@Deprecated
public static IRubyObject java_to_primitive(IRubyObject recv,
                                                       IRubyObject object,
                                                       Block unusedBlock)
Deprecated. 


primitive_to_java

@Deprecated
public static IRubyObject primitive_to_java(IRubyObject recv,
                                                       IRubyObject object,
                                                       Block unusedBlock)
Deprecated. 


convertArgument

@Deprecated
public static java.lang.Object convertArgument(Ruby runtime,
                                                          java.lang.Object argument,
                                                          java.lang.Class<?> parameterType)
Deprecated. 


java_to_ruby

@Deprecated
public static IRubyObject java_to_ruby(Ruby runtime,
                                                  IRubyObject object)
Deprecated. 

High-level object conversion utility function 'java_to_primitive' is the low-level version



Copyright © 2002-2009 JRuby Team. All Rights Reserved.