org.jruby.util
Class TypeConverter

java.lang.Object
  extended by org.jruby.util.TypeConverter

public class TypeConverter
extends java.lang.Object


Constructor Summary
TypeConverter()
           
 
Method Summary
static IRubyObject checkData(IRubyObject obj)
          Checks that this object is of type DATA and then returns it, otherwise raises failure (MRI: Check_Type(obj, T_DATA))
static IRubyObject convertToType(IRubyObject obj, RubyClass target, int convertMethodIndex, java.lang.String convertMethod)
          Deprecated. 
static IRubyObject convertToType(IRubyObject obj, RubyClass target, int convertMethodIndex, java.lang.String convertMethod, boolean raise)
          Deprecated. 
static IRubyObject convertToType(IRubyObject obj, RubyClass target, java.lang.String convertMethod)
          Converts this object to type 'targetType' using 'convertMethod' method and raises TypeError exception on failure (MRI: rb_convert_type).
static IRubyObject convertToType(IRubyObject obj, RubyClass target, java.lang.String convertMethod, boolean raise)
          Converts this object to type 'targetType' using 'convertMethod' method (MRI: convert_type).
static IRubyObject convertToTypeOrRaise(IRubyObject obj, RubyClass target, java.lang.String convertMethod)
          Higher level conversion utility similar to convertToType but it can throw an additional TypeError during conversion (MRI: rb_check_convert_type).
static IRubyObject convertToTypeWithCheck(IRubyObject obj, RubyClass target, int convertMethodIndex, java.lang.String convertMethod)
          Deprecated. 
static IRubyObject convertToTypeWithCheck(IRubyObject obj, RubyClass target, java.lang.String convertMethod)
          Higher level conversion utility similar to convertToType but it can throw an additional TypeError during conversion (MRI: rb_check_convert_type).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TypeConverter

public TypeConverter()
Method Detail

convertToType

@Deprecated
public static final IRubyObject convertToType(IRubyObject obj,
                                                         RubyClass target,
                                                         int convertMethodIndex,
                                                         java.lang.String convertMethod,
                                                         boolean raise)
Deprecated. 

Converts this object to type 'targetType' using 'convertMethod' method (MRI: convert_type).

Parameters:
obj - the object to convert
targetType - is the type we are trying to convert to
convertMethodIndex - the fast index to use for calling the method
convertMethod - is the method to be called to try and convert to targeType
raiseOnError - will throw an Error if conversion does not work
Returns:
the converted value

convertToType

public static final IRubyObject convertToType(IRubyObject obj,
                                              RubyClass target,
                                              java.lang.String convertMethod,
                                              boolean raise)
Converts this object to type 'targetType' using 'convertMethod' method (MRI: convert_type).

Parameters:
obj - the object to convert
targetType - is the type we are trying to convert to
convertMethodIndex - the fast index to use for calling the method
convertMethod - is the method to be called to try and convert to targeType
raiseOnError - will throw an Error if conversion does not work
Returns:
the converted value

convertToType

@Deprecated
public static final IRubyObject convertToType(IRubyObject obj,
                                                         RubyClass target,
                                                         int convertMethodIndex,
                                                         java.lang.String convertMethod)
Deprecated. 

Converts this object to type 'targetType' using 'convertMethod' method and raises TypeError exception on failure (MRI: rb_convert_type).

Parameters:
obj - the object to convert
targetType - is the type we are trying to convert to
convertMethodIndex - the fast index to use for calling the method
convertMethod - is the method to be called to try and convert to targeType
Returns:
the converted value

convertToType

public static final IRubyObject convertToType(IRubyObject obj,
                                              RubyClass target,
                                              java.lang.String convertMethod)
Converts this object to type 'targetType' using 'convertMethod' method and raises TypeError exception on failure (MRI: rb_convert_type).

Parameters:
obj - the object to convert
targetType - is the type we are trying to convert to
convertMethod - is the method to be called to try and convert to targeType
Returns:
the converted value

checkData

public static final IRubyObject checkData(IRubyObject obj)
Checks that this object is of type DATA and then returns it, otherwise raises failure (MRI: Check_Type(obj, T_DATA))

Parameters:
obj - the object to check
Returns:
the converted value

convertToTypeWithCheck

@Deprecated
public static final IRubyObject convertToTypeWithCheck(IRubyObject obj,
                                                                  RubyClass target,
                                                                  int convertMethodIndex,
                                                                  java.lang.String convertMethod)
Deprecated. 

Higher level conversion utility similar to convertToType but it can throw an additional TypeError during conversion (MRI: rb_check_convert_type).

Parameters:
obj - the object to convert
targetType - is the type we are trying to convert to
convertMethodIndex - the fast index to use for calling the method
convertMethod - is the method to be called to try and convert to targeType
Returns:
the converted value

convertToTypeWithCheck

public static final IRubyObject convertToTypeWithCheck(IRubyObject obj,
                                                       RubyClass target,
                                                       java.lang.String convertMethod)
Higher level conversion utility similar to convertToType but it can throw an additional TypeError during conversion (MRI: rb_check_convert_type).

Parameters:
obj - the object to convert
targetType - is the type we are trying to convert to
convertMethodIndex - the fast index to use for calling the method
convertMethod - is the method to be called to try and convert to targeType
Returns:
the converted value

convertToTypeOrRaise

public static final IRubyObject convertToTypeOrRaise(IRubyObject obj,
                                                     RubyClass target,
                                                     java.lang.String convertMethod)
Higher level conversion utility similar to convertToType but it can throw an additional TypeError during conversion (MRI: rb_check_convert_type).

Parameters:
obj - the object to convert
targetType - is the type we are trying to convert to
convertMethod - is the method to be called to try and convert to targeType
Returns:
the converted value


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