org.jruby
Class RubyClass

java.lang.Object
  extended by org.jruby.RubyObject
      extended by org.jruby.RubyModule
          extended by org.jruby.RubyClass
All Implemented Interfaces:
java.lang.Cloneable, IRubyObject
Direct Known Subclasses:
IncludedModuleWrapper, MetaClass

public class RubyClass
extends RubyModule

Author:
jpetersen

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jruby.RubyObject
RubyObject.Finalizer
 
Field Summary
static byte EQQ_SWITCHVALUE
           
static byte INSPECT_SWITCHVALUE
           
 
Fields inherited from class org.jruby.RubyModule
cref, id, index
 
Fields inherited from class org.jruby.RubyObject
instanceVariables, isTrue, metaClass, NEVER, OBJECT_ALLOCATOR
 
Fields inherited from interface org.jruby.runtime.builtin.IRubyObject
NULL_ARRAY
 
Constructor Summary
protected RubyClass(RubyClass superClass, ObjectAllocator allocator)
           
protected RubyClass(Ruby runtime, RubyClass superClass, ObjectAllocator allocator)
           
protected RubyClass(Ruby runtime, RubyClass metaClass, RubyClass superClass, ObjectAllocator allocator)
           
protected RubyClass(Ruby runtime, RubyClass metaClass, RubyClass superClass, ObjectAllocator allocator, SinglyLinkedList parentCRef, java.lang.String name)
           
 
Method Summary
 IRubyObject allocate()
           
 IRubyObject callMethod(ThreadContext context, RubyModule rubyclass, int methodIndex, java.lang.String name, IRubyObject[] args, CallType callType, Block block)
           
static RubyClass cloneClass(Ruby runtime, RubyClass metaClass, RubyClass superClass, ObjectAllocator allocator, SinglyLinkedList parentCRef, java.lang.String name)
           
static RubyClass createBootstrapMetaClass(Ruby runtime, java.lang.String className, RubyClass superClass, ObjectAllocator allocator, SinglyLinkedList cref)
          Create an initial Object meta class before Module and Kernel dependencies have squirreled themselves together.
static void createClassClass(RubyClass classClass)
           
protected  IRubyObject doClone()
           
 ObjectAllocator getAllocator()
           
 ObjectMarshal getMarshal()
           
 int getNativeTypeIndex()
          This is overridden in the other concrete Java builtins to provide a fast way to determine what type they are.
 RubyClass getRealClass()
           
 Ruby getRuntime()
          Getter for property ruby.
static IRubyObject inherited(IRubyObject recv, IRubyObject arg, Block block)
           
static IRubyObject inherited(RubyClass recv)
          rb_class_s_inherited
 void inheritedBy(RubyClass superType)
          Invokes if a class is inherited from an other class.
 IRubyObject initialize_copy(IRubyObject original)
          rb_class_init_copy
 boolean isClass()
           
 boolean isModule()
           
 boolean isSingleton()
           
 void marshal(java.lang.Object obj, MarshalStream marshalStream)
           
static void marshalTo(RubyClass clazz, MarshalStream output)
           
static RubyClass newClass(IRubyObject recv, IRubyObject[] args, Block block)
           
static RubyClass newClass(IRubyObject recv, IRubyObject[] args, Block block, boolean invokeInherited)
          rb_class_s_new
static RubyClass newClass(Ruby runtime, RubyClass superClass, SinglyLinkedList parentCRef, java.lang.String name)
           
static RubyClass newClassClass(Ruby runtime, RubyClass moduleClass)
           
 IRubyObject newInstance(IRubyObject[] args, Block block)
          rb_class_new_instance
 RubyClass newSubClass(java.lang.String name, ObjectAllocator allocator, SinglyLinkedList parentCRef, boolean warnOnRedefinition)
           
 RubyClass newSubClass(java.lang.String name, ObjectAllocator allocator, SinglyLinkedList parentCRef, boolean invokeInherited, boolean warnOnRedefinition)
           
 void setMarshal(ObjectMarshal marshal)
           
protected  RubyClass subclass()
          Create a new subclass of this class.
 IRubyObject superclass(Block block)
          Return the real super class of this class.
 java.lang.Object unmarshal(UnmarshalStream unmarshalStream)
           
static RubyModule unmarshalFrom(UnmarshalStream output)
           
 
Methods inherited from class org.jruby.RubyModule
addClassProvider, addMethod, addModuleFunction, alias_method, ancestors, append_features, attr_accessor, attr_reader, attr_writer, attr, class_variable_get, class_variable_set, class_variables, cloneMethods, const_defined, const_get, const_missing, const_set, constants, createModuleClass, define_method, defineAlias, defineClassUnder, defineConstant, defineFastMethod, defineFastMethod, defineFastModuleFunction, defineFastPrivateMethod, defineFastProtectedMethod, defineFastPublicModuleFunction, defineMethod, defineModuleFunction, defineModuleUnder, defineOrGetClassUnder, definePrivateMethod, definePublicModuleFunction, executeUnder, exportMethod, extend_object, extended, findImplementer, getAncestorList, getBaseName, getClass, getClassVar, getConstant, getConstantAt, getConstantFrom, getCRef, getMethods, getName, getNonIncludedClass, getParent, getSuperClass, hash, hashCode, hasModuleInHierarchy, include_p, include, included_modules, included, includeModule, initialize, instance_method, instance_methods, isClassVarDefined, isIncluded, isKindOfModule, isMethodBound, isSame, marshalTo, method_added, method_defined, method_removed, method_undefined, module_eval, module_function, name, nesting, newIncludeClass, newMethod, newModule, newModule, newModule, newModule, op_cmp, op_eqq, op_ge, op_gt, op_le, op_lt, private_class_method, private_instance_methods, private_method_defined, protected_instance_methods, protected_method_defined, public_class_method, public_instance_methods, public_method_defined, putMethod, rbPrivate, rbProtected, rbPublic, remove_class_variable, remove_const, remove_method, removeCachedMethod, removeClassProvider, removeCvar, removeMethod, retrieveMethod, searchMethod, setBaseName, setClassVar, setConstant, setMethodVisibility, setParent, setSuperClass, to_s, undef_method, undef, undefineMethod
 
Methods inherited from class org.jruby.RubyObject
addFinalizer, anyToString, asString, asSymbol, attachToObjectSpace, callInit, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethodMissing, callMethodMissing, callSuper, checkArrayType, checkFrozen, checkStringType, compilerCallMethod, compilerCallMethodWithIndex, convertToArray, convertToFloat, convertToHash, convertToInteger, convertToString, convertToType, convertToType, convertToType, convertToTypeWithCheck, createObjectClass, dataGetStruct, dataWrapStruct, display, dup, eql, eqlInternal, equal, equalInternal, equals, evalSimple, evalUnder, evalWithBinding, extend, freeze, frozen, getInstanceVariable, getInstanceVariables, getInstanceVariablesSnapshot, getJavaClass, getMetaClass, getSingletonClass, getSingletonClassClone, getType, id_deprecated, id, infectBy, inherited, initCopy, inspect, instance_eval, instance_exec, instance_of, instance_variable_get, instance_variable_set, instance_variables, instanceVariableNames, isFalse, isFrozen, isImmediate, isKindOf, isNil, isTaint, isTrue, kind_of, makeMetaClass, match, method, methods, nil_p, obj_equal, private_methods, protected_methods, public_methods, puts, rbClone, remove_instance_variable, removeFinalizers, removeInstanceVariable, respond_to, respondsTo, safeGetInstanceVariables, safeHasInstanceVariables, send, setFrozen, setInstanceVariable, setInstanceVariable, setInstanceVariables, setMetaClass, setTaint, singleton_methods, specificEval, taint, tainted, testFrozen, toString, trueFalseNil, trueFalseNil, type_deprecated, type, untaint
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

EQQ_SWITCHVALUE

public static final byte EQQ_SWITCHVALUE
See Also:
Constant Field Values

INSPECT_SWITCHVALUE

public static final byte INSPECT_SWITCHVALUE
See Also:
Constant Field Values
Constructor Detail

RubyClass

protected RubyClass(RubyClass superClass,
                    ObjectAllocator allocator)

RubyClass

protected RubyClass(Ruby runtime,
                    RubyClass superClass,
                    ObjectAllocator allocator)

RubyClass

protected RubyClass(Ruby runtime,
                    RubyClass metaClass,
                    RubyClass superClass,
                    ObjectAllocator allocator)

RubyClass

protected RubyClass(Ruby runtime,
                    RubyClass metaClass,
                    RubyClass superClass,
                    ObjectAllocator allocator,
                    SinglyLinkedList parentCRef,
                    java.lang.String name)
Method Detail

createBootstrapMetaClass

public static RubyClass createBootstrapMetaClass(Ruby runtime,
                                                 java.lang.String className,
                                                 RubyClass superClass,
                                                 ObjectAllocator allocator,
                                                 SinglyLinkedList cref)
Create an initial Object meta class before Module and Kernel dependencies have squirreled themselves together.

Parameters:
runtime - we need it
Returns:
a half-baked meta class for object

getNativeTypeIndex

public int getNativeTypeIndex()
Description copied from class: RubyObject
This is overridden in the other concrete Java builtins to provide a fast way to determine what type they are.

Specified by:
getNativeTypeIndex in interface IRubyObject
Overrides:
getNativeTypeIndex in class RubyModule
Returns:
the ClassIndex of the native type this object was constructed from

callMethod

public IRubyObject callMethod(ThreadContext context,
                              RubyModule rubyclass,
                              int methodIndex,
                              java.lang.String name,
                              IRubyObject[] args,
                              CallType callType,
                              Block block)
Specified by:
callMethod in interface IRubyObject
Overrides:
callMethod in class RubyModule
Returns:

allocate

public final IRubyObject allocate()

getMarshal

public final ObjectMarshal getMarshal()

setMarshal

public final void setMarshal(ObjectMarshal marshal)

marshal

public final void marshal(java.lang.Object obj,
                          MarshalStream marshalStream)
                   throws java.io.IOException
Throws:
java.io.IOException

unmarshal

public final java.lang.Object unmarshal(UnmarshalStream unmarshalStream)
                                 throws java.io.IOException
Throws:
java.io.IOException

newClassClass

public static RubyClass newClassClass(Ruby runtime,
                                      RubyClass moduleClass)

getRuntime

public Ruby getRuntime()
Description copied from class: RubyObject
Getter for property ruby.

Specified by:
getRuntime in interface IRubyObject
Overrides:
getRuntime in class RubyObject
Returns:
Value of property ruby.

isModule

public boolean isModule()
Overrides:
isModule in class RubyModule

isClass

public boolean isClass()
Overrides:
isClass in class RubyModule

createClassClass

public static void createClassClass(RubyClass classClass)

inherited

public static IRubyObject inherited(IRubyObject recv,
                                    IRubyObject arg,
                                    Block block)

inheritedBy

public void inheritedBy(RubyClass superType)
Invokes if a class is inherited from an other class. MRI: rb_class_inherited

Since:
Ruby 1.6.7

isSingleton

public boolean isSingleton()
Specified by:
isSingleton in interface IRubyObject
Overrides:
isSingleton in class RubyModule
Returns:

getRealClass

public RubyClass getRealClass()

newClass

public static RubyClass newClass(Ruby runtime,
                                 RubyClass superClass,
                                 SinglyLinkedList parentCRef,
                                 java.lang.String name)

cloneClass

public static RubyClass cloneClass(Ruby runtime,
                                   RubyClass metaClass,
                                   RubyClass superClass,
                                   ObjectAllocator allocator,
                                   SinglyLinkedList parentCRef,
                                   java.lang.String name)

subclass

protected RubyClass subclass()
Create a new subclass of this class.

Returns:
the new sublass
Throws:
TypeError - if this is class `Class'

newInstance

public IRubyObject newInstance(IRubyObject[] args,
                               Block block)
rb_class_new_instance


getAllocator

public ObjectAllocator getAllocator()

newClass

public static RubyClass newClass(IRubyObject recv,
                                 IRubyObject[] args,
                                 Block block,
                                 boolean invokeInherited)
rb_class_s_new


newClass

public static RubyClass newClass(IRubyObject recv,
                                 IRubyObject[] args,
                                 Block block)

superclass

public IRubyObject superclass(Block block)
Return the real super class of this class. rb_class_superclass


inherited

public static IRubyObject inherited(RubyClass recv)
rb_class_s_inherited


marshalTo

public static void marshalTo(RubyClass clazz,
                             MarshalStream output)
                      throws java.io.IOException
Throws:
java.io.IOException

unmarshalFrom

public static RubyModule unmarshalFrom(UnmarshalStream output)
                                throws java.io.IOException
Throws:
java.io.IOException

newSubClass

public RubyClass newSubClass(java.lang.String name,
                             ObjectAllocator allocator,
                             SinglyLinkedList parentCRef,
                             boolean invokeInherited,
                             boolean warnOnRedefinition)

newSubClass

public RubyClass newSubClass(java.lang.String name,
                             ObjectAllocator allocator,
                             SinglyLinkedList parentCRef,
                             boolean warnOnRedefinition)

doClone

protected IRubyObject doClone()
Overrides:
doClone in class RubyModule

initialize_copy

public IRubyObject initialize_copy(IRubyObject original)
rb_class_init_copy

Overrides:
initialize_copy in class RubyModule


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