org.jruby
Class RubyClass

java.lang.Object
  extended by org.jruby.RubyBasicObject
      extended by org.jruby.RubyObject
          extended by org.jruby.RubyModule
              extended by org.jruby.RubyClass
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<IRubyObject>, InstanceVariables, InternalVariables, IRubyObject, CoreObjectType
Direct Known Subclasses:
IncludedModuleWrapper, MetaClass

public class RubyClass
extends RubyModule

Author:
jpetersen
See Also:
Serialized Form

Nested Class Summary
static class RubyClass.VariableAccessor
           
 
Nested classes/interfaces inherited from class org.jruby.RubyModule
RubyModule.CacheEntryFactory, RubyModule.KindOf, RubyModule.MethodClumper, RubyModule.ModuleKernelMethods, RubyModule.ProfilingCacheEntryFactory, RubyModule.RespondToMissingMethod, RubyModule.SynchronizedCacheEntryFactory, RubyModule.WrapperCacheEntryFactory
 
Nested classes/interfaces inherited from class org.jruby.RubyObject
RubyObject.Data
 
Nested classes/interfaces inherited from class org.jruby.RubyBasicObject
RubyBasicObject.Finalizer
 
Field Summary
static ObjectAllocator CLASS_ALLOCATOR
           
static int CS_IDX_INITIALIZE
           
static java.lang.String[] CS_NAMES
           
protected static ObjectMarshal DEFAULT_OBJECT_MARSHAL
           
protected  ObjectMarshal marshal
           
protected  Ruby runtime
           
 
Fields inherited from class org.jruby.RubyModule
classId, ERR_FROZEN_CONST_TYPE, ERR_FROZEN_CVAR_TYPE, ERR_INSECURE_SET_CLASS_VAR, ERR_INSECURE_SET_CONSTANT, generation, id, includingHierarchies, index, kindOf, MODULE_ALLOCATOR, NormalCacheEntryFactory, parent, SCOPE_CAPTURING_METHODS, superClass
 
Fields inherited from class org.jruby.RubyObject
OBJECT_ALLOCATOR, REIFYING_OBJECT_ALLOCATOR
 
Fields inherited from class org.jruby.RubyBasicObject
ALL_F, BASICOBJECT_ALLOCATOR, COMPARE_BY_IDENTITY_F, ERR_INSECURE_SET_INST_VAR, FALSE_F, FL_USHIFT, flags, FROZEN_F, metaClass, NEVER, NIL_F, TAINTED_F, UNDEF, UNTRUSTED_F, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F, USER8_F
 
Fields inherited from interface org.jruby.runtime.builtin.IRubyObject
NULL_ARRAY
 
Constructor Summary
protected RubyClass(Ruby runtime)
          used by CLASS_ALLOCATOR (any Class' class will be a Class!) also used to bootstrap Object class
protected RubyClass(Ruby runtime, RubyClass superClazz)
          rb_class_boot (for plain Classes) also used to bootstrap Module and Class classes
protected RubyClass(Ruby runtime, RubyClass superClass, boolean objectSpace)
          separate path for MetaClass and IncludedModuleWrapper construction (rb_class_boot version for MetaClasses) no marshal, allocator initialization and addSubclass(this) here!
protected RubyClass(Ruby runtime, RubyClass superClazz, CallSite[] extraCallSites)
          A constructor which allows passing in an array of supplementary call sites.
 
Method Summary
 void addClassAnnotation(java.lang.Class annotation, java.util.Map fields)
           
 void addMethodAnnotation(java.lang.String methodName, java.lang.Class annotation, java.util.Map fields)
           
 void addMethodSignature(java.lang.String methodName, java.lang.Class[] types)
           
 void addParameterAnnotation(java.lang.String method, int i, java.lang.Class annoClass, java.util.Map<java.lang.String,java.lang.Object> value)
           
 void addSubclass(RubyClass subclass)
          Add a new subclass to the weak set of subclasses.
 IRubyObject allocate()
           
 void becomeSynchronized()
           
static void checkInheritable(IRubyObject superClass)
          rb_check_inheritable
static RubyClass createBootstrapClass(Ruby runtime, java.lang.String name, RubyClass superClass, ObjectAllocator allocator)
          boot_defclass Create an initial Object meta class before Module and Kernel dependencies have squirreled themselves together.
static void createClassClass(Ruby runtime, RubyClass classClass)
           
 IRubyObject finvoke(ThreadContext context, IRubyObject self, java.lang.String name)
           
 IRubyObject finvoke(ThreadContext context, IRubyObject self, java.lang.String name, Block block)
           
 IRubyObject finvoke(ThreadContext context, IRubyObject self, java.lang.String name, IRubyObject arg)
           
 IRubyObject finvoke(ThreadContext context, IRubyObject self, java.lang.String name, IRubyObject[] args)
           
 IRubyObject finvoke(ThreadContext context, IRubyObject self, java.lang.String name, IRubyObject[] args, Block block)
           
 IRubyObject finvoke(ThreadContext context, IRubyObject self, java.lang.String name, IRubyObject arg, Block block)
           
 IRubyObject finvoke(ThreadContext context, IRubyObject self, java.lang.String name, IRubyObject arg0, IRubyObject arg1)
           
 IRubyObject finvoke(ThreadContext context, IRubyObject self, java.lang.String name, IRubyObject arg0, IRubyObject arg1, Block block)
           
 IRubyObject finvoke(ThreadContext context, IRubyObject self, java.lang.String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2)
           
 IRubyObject finvoke(ThreadContext context, IRubyObject self, java.lang.String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block)
           
 IRubyObject finvokeChecked(ThreadContext context, IRubyObject self, java.lang.String name)
           
 ObjectAllocator getAllocator()
           
 CallSite[] getBaseCallSites()
           
 java.util.Map<java.lang.Class,java.util.Map<java.lang.String,java.lang.Object>> getClassAnnotations()
           
 Ruby getClassRuntime()
           
 CallSite[] getExtraCallSites()
           
 ObjectMarshal getMarshal()
           
 java.util.Map<java.lang.String,java.util.Map<java.lang.Class,java.util.Map<java.lang.String,java.lang.Object>>> getMethodAnnotations()
           
 java.util.Map<java.lang.String,java.lang.Class[]> getMethodSignatures()
           
 int getNativeTypeIndex()
          This is overridden in the other concrete Java builtins to provide a fast way to determine what type they are.
 RubyClass.VariableAccessor getObjectIdAccessorForRead()
           
 RubyClass.VariableAccessor getObjectIdAccessorForWrite()
           
 java.util.Map<java.lang.String,java.util.List<java.util.Map<java.lang.Class,java.util.Map<java.lang.String,java.lang.Object>>>> getParameterAnnotations()
           
 RubyClass getRealClass()
           
 java.lang.Class getReifiedClass()
           
 RubyClass.VariableAccessor getVariableAccessorForRead(java.lang.String name)
           
 RubyClass.VariableAccessor getVariableAccessorForWrite(java.lang.String name)
           
 java.util.Map<java.lang.String,RubyClass.VariableAccessor> getVariableAccessorsForRead()
           
 java.lang.String[] getVariableNames()
          Get an array of all the known instance variable names.
 java.util.Map<java.lang.String,RubyClass.VariableAccessor> getVariableTableCopy()
           
 int getVariableTableSize()
           
 int getVariableTableSizeWithObjectId()
           
 boolean hasObjectID()
           
 void inherit(RubyClass superClazz)
          rb_class_inherited (reversed semantics!)
 IRubyObject inherited(ThreadContext context, IRubyObject arg)
           
 IRubyObject initialize_copy(IRubyObject original)
          rb_class_init_copy
 IRubyObject initialize(ThreadContext context, Block block)
          rb_class_initialize
 IRubyObject initialize(ThreadContext context, IRubyObject superObject, Block block)
           
 IRubyObject initialize19(ThreadContext context, Block block)
          rb_mod_initialize
 IRubyObject initialize19(ThreadContext context, IRubyObject superObject, Block block)
           
 void invalidateCacheDescendants()
          Invalidate all subclasses of this class by walking the set of all subclasses and asking them to invalidate themselves.
 IRubyObject invoke(ThreadContext context, IRubyObject self, int methodIndex, java.lang.String name, IRubyObject[] args, CallType callType, Block block)
          Deprecated. 
 IRubyObject invoke(ThreadContext context, IRubyObject self, java.lang.String name, CallType callType)
           
 IRubyObject invoke(ThreadContext context, IRubyObject self, java.lang.String name, CallType callType, Block block)
           
 IRubyObject invoke(ThreadContext context, IRubyObject self, java.lang.String name, IRubyObject[] args, CallType callType)
           
 IRubyObject invoke(ThreadContext context, IRubyObject self, java.lang.String name, IRubyObject[] args, CallType callType, Block block)
           
 IRubyObject invoke(ThreadContext context, IRubyObject self, java.lang.String name, IRubyObject arg, CallType callType)
           
 IRubyObject invoke(ThreadContext context, IRubyObject self, java.lang.String name, IRubyObject arg, CallType callType, Block block)
           
 IRubyObject invoke(ThreadContext context, IRubyObject self, java.lang.String name, IRubyObject arg0, IRubyObject arg1, CallType callType)
           
 IRubyObject invoke(ThreadContext context, IRubyObject self, java.lang.String name, IRubyObject arg0, IRubyObject arg1, CallType callType, Block block)
           
 IRubyObject invoke(ThreadContext context, IRubyObject self, java.lang.String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, CallType callType)
           
 IRubyObject invoke(ThreadContext context, IRubyObject self, java.lang.String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, CallType callType, Block block)
           
 IRubyObject invokeInherited(ThreadContext context, IRubyObject self, IRubyObject subclass)
           
 boolean isClass()
          Specifically polymorphic method that are meant to be overridden by classes to specify that they are classes in an easy way.
 boolean isModule()
          Specifically polymorphic method that are meant to be overridden by modules to specify that they are modules in an easy way.
 boolean isReifiable()
          Whether this class can be reified into a Java class.
 boolean isSingleton()
           
 RubyClass makeMetaClass(RubyClass superClass)
          rb_make_metaclass
 void marshal(java.lang.Object obj, MarshalStream marshalStream)
           
static void marshalTo(RubyClass clazz, MarshalStream output)
           
static RubyClass newClass(Ruby runtime, RubyClass superClass)
          Construct a new class with the given name scoped under Object (global) and with Object as its immediate superclass.
static RubyClass newClass(Ruby runtime, RubyClass superClass, CallSite[] extraCallSites)
          A variation on newClass that allow passing in an array of supplementary call sites to improve dynamic invocation.
static RubyClass newClass(Ruby runtime, RubyClass superClass, java.lang.String name, ObjectAllocator allocator, RubyModule parent, boolean setParent)
          Construct a new class with the given name, allocator, parent class, and containing class.
static RubyClass newClass(Ruby runtime, RubyClass superClass, java.lang.String name, ObjectAllocator allocator, RubyModule parent, boolean setParent, CallSite[] extraCallSites)
          A variation on newClass that allows passing in an array of supplementary call sites to improve dynamic invocation performance.
 IRubyObject newInstance(ThreadContext context, Block block)
          rb_class_new_instance
 IRubyObject newInstance(ThreadContext context, IRubyObject[] args, Block block)
           
 IRubyObject newInstance(ThreadContext context, IRubyObject arg0, Block block)
           
 IRubyObject newInstance(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block)
           
 IRubyObject newInstance(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block)
           
 boolean notVisibleAndNotMethodMissing(DynamicMethod method, java.lang.String name, IRubyObject caller, CallType callType)
           
 void reify()
           
 void reify(java.lang.String classDumpDir)
          Stand up a real Java class for the backing store of this object
 void reifyWithAncestors()
          Reify this class, first reifying all its ancestors.
 void reifyWithAncestors(java.lang.String classDumpDir)
          Reify this class, first reifying all its ancestors.
 void removeSubclass(RubyClass subclass)
          Remove a subclass from the weak set of subclasses.
 void replaceSubclass(RubyClass subclass, RubyClass newSubclass)
          Replace an existing subclass with a new one.
 void setAllocator(ObjectAllocator allocator)
           
 void setClassAllocator(java.lang.Class cls)
          Set a reflective allocator that calls a no-arg constructor on the given class.
 void setMarshal(ObjectMarshal marshal)
           
protected  void setModuleSuperClass(RubyClass superClass)
           
 void setReifiedClass(java.lang.Class newReifiedClass)
           
 void setRubyClassAllocator(java.lang.Class cls)
          Set a reflective allocator that calls the "standard" Ruby object constructor (Ruby, RubyClass) on the given class.
 void setRubyStaticAllocator(java.lang.Class cls)
          Set a reflective allocator that calls the "standard" Ruby object constructor (Ruby, RubyClass) on the given class via a static __allocate__ method intermediate.
 void smartDump(MarshalStream stream, IRubyObject target)
          Marshal the given object to the marshaling stream, being "smart" and caching how to do that marshaling.
 IRubyObject smartLoadNewUser(IRubyObject target, IRubyObject data)
          Load marshaled data into a blank target object using marshal_load, being "smart" and caching the mechanism for invoking marshal_load.
 IRubyObject smartLoadOldUser(IRubyObject data)
          Load marshaled data into a blank target object using _load, being "smart" and caching the mechanism for invoking _load.
 java.util.Collection<RubyClass> subclasses(boolean includeDescendants)
           
 IRubyObject superclass(ThreadContext context)
          Return the real super class of this class.
 java.lang.Object toJava(java.lang.Class klass)
          Convert the object to the specified Java class, if possible.
 java.lang.Object unmarshal(UnmarshalStream unmarshalStream)
           
static RubyClass unmarshalFrom(UnmarshalStream input)
           
 
Methods inherited from class org.jruby.RubyModule
addClassProvider, addIncludingHierarchy, addMethod, addMethodAtBootTimeOnly, addMethodInternal, addModuleFunction, addReadAttribute, addReadWriteAttribute, addWriteAttribute, alias_method, ancestors, ancestors, append_features, attr_accessor, attr_accessor, attr_reader, attr_reader, attr_writer, attr, attr19, checkMethodBound, class_variable_defined_p, class_variable_get, class_variable_set, class_variables, class_variables19, cloneMethods, const_defined_p, const_defined_p19, const_get, const_get, const_missing, const_set, constants, constants19, constants19, constantsCommon, constantsCommon19, constantTableContains, constantTableFastContains, constantTableFastFetch, constantTableFastStore, constantTableFetch, constantTableRemove, constantTableStore, createModuleClass, define_method, define_method, define_method, defineAlias, defineAliases, defineAnnotatedConstant, defineAnnotatedConstants, defineAnnotatedMethod, defineAnnotatedMethod, defineAnnotatedMethod, defineAnnotatedMethod, defineAnnotatedMethods, defineAnnotatedMethodsIndividually, defineClassUnder, defineConstant, defineFastMethod, defineFastMethod, defineFastModuleFunction, defineFastPrivateMethod, defineFastProtectedMethod, defineFastPublicModuleFunction, defineMethod, defineModuleFunction, defineModuleUnder, defineOrGetClassUnder, defineOrGetModuleUnder, definePrivateMethod, definePublicModuleFunction, deleteClassVariable, deleteConstant, ensureClassVariablesSettable, ensureConstantsSettable, equals, executeUnder, exportMethod, extend_object, extended, fastFetchClassVariable, fastFetchConstant, fastGetClass, fastGetClassVar, fastGetConstant, fastGetConstant, fastGetConstantAt, fastGetConstantFrom, fastGetConstantFromConstMissing, fastGetConstantFromNoConstMissing, fastHasClassVariable, fastHasConstant, fastIsClassVarDefined, fastIsConstantDefined, fastIsConstantDefined19, fastIsConstantDefined19, fastSetClassVar, fastSetConstant, fastStoreClassVariable, fastStoreConstant, fetchClassVariable, fetchConstant, findImplementer, freeze, getAncestorList, getBaseName, getCacheToken, getClass, getClassVar, getClassVariableNameList, getClassVariables, getClassVariablesForRead, getConstant, getConstant, getConstantAt, getConstantAtSpecial, getConstantFrom, getConstantInner, getConstantMap, getConstantMapForWrite, getConstantNames, getConstantNoConstMissing, getConstantNoConstMissing, getMethods, getMethodsForWrite, getName, getNonIncludedClass, getParent, getStoredConstantList, getStoredConstantNameList, getSuperClass, hasClassVariable, hasConstant, hash, hashCode, hasInternalModuleVariable, hasModuleInHierarchy, include_p, include, included_modules, included, includeModule, initialize, instance_method, instance_methods, instance_methods19, invalidateCacheDescendantsInner, invalidateConstantCache, invalidateCoreClasses, isClassVarDefined, isConstantDefined, isIncluded, isInstance, isKindOfModule, isMethodBound, isMethodBound, isSame, isSynchronized, marshalTo, method_added, method_defined_p, method_removed, method_undefined, module_eval, module_eval, module_eval, module_eval, module_eval, module_exec, module_exec, module_function, name, name19, needsImplementer, nesting, newIncludeClass, newMethod, newMethod, newMethod, newModule, newModule, op_cmp, op_eqq, op_equal, op_ge, op_gt, op_le, op_lt, populateInstanceMethodNames, private_class_method, private_instance_methods, private_instance_methods19, private_method_defined, protected_instance_methods, protected_instance_methods19, protected_method_defined, public_class_method, public_instance_methods, public_instance_methods19, public_method_defined, rbPrivate, rbProtected, rbPublic, remove_class_variable, remove_const, remove_method, removeClassProvider, removeClassVariable, removeCvar, removeMethod, resolveUndefConstant, retrieveMethod, searchInternalModuleVariable, searchMethod, searchMethodInner, searchWithCache, setBaseName, setClassVar, setConstant, setConstantQuiet, setInternalModuleVariable, setMethodVisibility, setParent, setSuperClass, storeClassVariable, storeConstant, syncClassVariables, syncConstants, to_s, undef_method, undef, undefineMethod, validateClassVariable, validateConstant
 
Methods inherited from class org.jruby.RubyObject
attachToObjectSpace, callInit, callInit, callInit, callInit, callInit, convertToType, createObjectClass, eqlInternal, equalInternal, initialize, puts, specificEval, toString
 
Methods inherited from class org.jruby.RubyBasicObject
addFinalizer, anyToString, asJavaString, asString, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, checkArrayType, checkCallMethod, checkFrozen, checkStringType, checkStringType19, compareTo, convertToArray, convertToFloat, convertToHash, convertToInteger, convertToInteger, convertToInteger, convertToString, copyInstanceVariablesInto, copySpecialInstanceVariables, createBasicObjectClass, dataGetStruct, dataGetStructChecked, dataWrapStruct, display, dup, ensureInstanceVariablesSettable, eql_p, eql, equal_p, equal_p19, evalUnder, extend, fastGetInstanceVariable, fastGetInternalVariable, fastHasInstanceVariable, fastHasInternalVariable, fastSetInstanceVariable, fastSetInternalVariable, frozen_p, getFlag, getInstanceEvalClass, getInstanceVariable, getInstanceVariableList, getInstanceVariableNameList, getInstanceVariables, getInternalVariable, getInternalVariables, getJavaClass, getMetaClass, getObjectId, getRuntime, getSingletonClass, getSingletonClassClone, getType, getVariable, getVariableCount, getVariableList, getVariableNameList, hashyInspect, hasInstanceVariable, hasInternalVariable, hasVariables, id_deprecated, id, infectBy, initialize19, initialize19, initialize19, initialize19, initialize19, initObjectId, inspect, inspectHashCode, instance_eval, instance_eval, instance_eval, instance_eval, instance_eval19, instance_eval19, instance_eval19, instance_eval19, instance_exec, instance_exec19, instance_of_p, instance_variable_defined_p, instance_variable_get, instance_variable_set, instance_variables, instance_variables19, isBuiltin, isFalse, isFrozen, isImmediate, isNil, isTaint, isTrue, isUntrusted, kind_of_p, method_missing19, method, method19, methods, methods, methods19, nil_p, op_cmp, op_equal_19, op_match, op_match19, op_not_equal, op_not_match, op_not, private_methods, private_methods19, protected_methods, protected_methods19, public_methods, public_methods19, rbClone, remove_instance_variable, removeFinalizers, removeInstanceVariable, removeInternalVariable, respond_to_p, respond_to_p, respond_to_p19, respond_to_p19, respondsTo, respondsToMissing, respondsToMissing, send, send, send, send, send, send19, send19, send19, send19, send19, setFlag, setFrozen, setInstanceVariable, setInternalVariable, setMetaClass, setTaint, setUntrusted, setVariable, singleton_method_added19, singleton_method_removed19, singleton_method_undefined19, singleton_methods, singleton_methods19, specificEval, specificEval, specificEval, specificEval, syncVariables, syncVariables, taint, taint, tainted_p, testFrozen, testFrozen, to_a, trust, type_deprecated, type, untaint, untrust, untrusted_p, validateInstanceVariable, variableTableContains, variableTableFastContains, variableTableFastFetch, variableTableFastStore, variableTableFetch, variableTableRemove, variableTableStore, variableTableSync, yieldUnder, yieldUnder
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CLASS_ALLOCATOR

public static final ObjectAllocator CLASS_ALLOCATOR

DEFAULT_OBJECT_MARSHAL

protected static final ObjectMarshal DEFAULT_OBJECT_MARSHAL

runtime

protected final Ruby runtime

marshal

protected ObjectMarshal marshal

CS_IDX_INITIALIZE

public static final int CS_IDX_INITIALIZE
See Also:
Constant Field Values

CS_NAMES

public static final java.lang.String[] CS_NAMES
Constructor Detail

RubyClass

protected RubyClass(Ruby runtime,
                    RubyClass superClass,
                    boolean objectSpace)
separate path for MetaClass and IncludedModuleWrapper construction (rb_class_boot version for MetaClasses) no marshal, allocator initialization and addSubclass(this) here!


RubyClass

protected RubyClass(Ruby runtime)
used by CLASS_ALLOCATOR (any Class' class will be a Class!) also used to bootstrap Object class


RubyClass

protected RubyClass(Ruby runtime,
                    RubyClass superClazz)
rb_class_boot (for plain Classes) also used to bootstrap Module and Class classes


RubyClass

protected RubyClass(Ruby runtime,
                    RubyClass superClazz,
                    CallSite[] extraCallSites)
A constructor which allows passing in an array of supplementary call sites.

Method Detail

createClassClass

public static void createClassClass(Ruby runtime,
                                    RubyClass classClass)

getAllocator

public ObjectAllocator getAllocator()

setAllocator

public void setAllocator(ObjectAllocator allocator)

setClassAllocator

public void setClassAllocator(java.lang.Class cls)
Set a reflective allocator that calls a no-arg constructor on the given class.

Parameters:
cls - The class on which to call the default constructor to allocate

setRubyClassAllocator

public void setRubyClassAllocator(java.lang.Class cls)
Set a reflective allocator that calls the "standard" Ruby object constructor (Ruby, RubyClass) on the given class.

Parameters:
cls - The class from which to grab a standard Ruby constructor

setRubyStaticAllocator

public void setRubyStaticAllocator(java.lang.Class cls)
Set a reflective allocator that calls the "standard" Ruby object constructor (Ruby, RubyClass) on the given class via a static __allocate__ method intermediate.

Parameters:
cls - The class from which to grab a standard Ruby __allocate__ method.

allocate

public IRubyObject allocate()

getBaseCallSites

public CallSite[] getBaseCallSites()

getExtraCallSites

public CallSite[] getExtraCallSites()

getVariableAccessorsForRead

public java.util.Map<java.lang.String,RubyClass.VariableAccessor> getVariableAccessorsForRead()

getVariableAccessorForWrite

public RubyClass.VariableAccessor getVariableAccessorForWrite(java.lang.String name)

getVariableAccessorForRead

public RubyClass.VariableAccessor getVariableAccessorForRead(java.lang.String name)

getObjectIdAccessorForWrite

public RubyClass.VariableAccessor getObjectIdAccessorForWrite()

getObjectIdAccessorForRead

public RubyClass.VariableAccessor getObjectIdAccessorForRead()

getVariableTableSize

public int getVariableTableSize()

getVariableTableSizeWithObjectId

public int getVariableTableSizeWithObjectId()

getVariableTableCopy

public java.util.Map<java.lang.String,RubyClass.VariableAccessor> getVariableTableCopy()

getVariableNames

public java.lang.String[] getVariableNames()
Get an array of all the known instance variable names. The offset into the array indicates the offset of the variable's value in the per-object variable array.

Returns:
a copy of the array of known instance variable names

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. Will generally return a value from org.jruby.runtime.ClassIndex

Specified by:
getNativeTypeIndex in interface CoreObjectType
Overrides:
getNativeTypeIndex in class RubyModule
Returns:
the ClassIndex of the native type this object was constructed from
See Also:
org.jruby.runtime.ClassInde

isModule

public boolean isModule()
Description copied from class: RubyBasicObject
Specifically polymorphic method that are meant to be overridden by modules to specify that they are modules in an easy way.

Specified by:
isModule in interface IRubyObject
Overrides:
isModule in class RubyModule
Returns:
true if an object is Ruby Module instance (note that it will return false for Ruby Classes). If is_a? semantics is required, use (someObject instanceof RubyModule) instead.

isClass

public boolean isClass()
Description copied from class: RubyBasicObject
Specifically polymorphic method that are meant to be overridden by classes to specify that they are classes in an easy way.

Specified by:
isClass in interface IRubyObject
Overrides:
isClass in class RubyModule
Returns:
true if an object is Ruby Class instance (note that it will return false for Ruby singleton classes). If is_a? semantics is required, use (someObject instanceof RubyClass/MetaClass) instead.

isSingleton

public boolean isSingleton()
Overrides:
isSingleton in class RubyModule

createBootstrapClass

public static RubyClass createBootstrapClass(Ruby runtime,
                                             java.lang.String name,
                                             RubyClass superClass,
                                             ObjectAllocator allocator)
boot_defclass 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

newClass

public static RubyClass newClass(Ruby runtime,
                                 RubyClass superClass)
Construct a new class with the given name scoped under Object (global) and with Object as its immediate superclass. Corresponds to rb_class_new in MRI.


newClass

public static RubyClass newClass(Ruby runtime,
                                 RubyClass superClass,
                                 CallSite[] extraCallSites)
A variation on newClass that allow passing in an array of supplementary call sites to improve dynamic invocation.


newClass

public static RubyClass newClass(Ruby runtime,
                                 RubyClass superClass,
                                 java.lang.String name,
                                 ObjectAllocator allocator,
                                 RubyModule parent,
                                 boolean setParent)
Construct a new class with the given name, allocator, parent class, and containing class. If setParent is true, the class's parent will be explicitly set to the provided parent (rather than the new class just being assigned to a constant in that parent). Corresponds to rb_class_new/rb_define_class_id/rb_name_class/rb_set_class_path in MRI.


newClass

public static RubyClass newClass(Ruby runtime,
                                 RubyClass superClass,
                                 java.lang.String name,
                                 ObjectAllocator allocator,
                                 RubyModule parent,
                                 boolean setParent,
                                 CallSite[] extraCallSites)
A variation on newClass that allows passing in an array of supplementary call sites to improve dynamic invocation performance.


makeMetaClass

public RubyClass makeMetaClass(RubyClass superClass)
rb_make_metaclass

Overrides:
makeMetaClass in class RubyBasicObject

invoke

@Deprecated
public IRubyObject invoke(ThreadContext context,
                                     IRubyObject self,
                                     int methodIndex,
                                     java.lang.String name,
                                     IRubyObject[] args,
                                     CallType callType,
                                     Block block)
Deprecated. 


notVisibleAndNotMethodMissing

public boolean notVisibleAndNotMethodMissing(DynamicMethod method,
                                             java.lang.String name,
                                             IRubyObject caller,
                                             CallType callType)

invoke

public IRubyObject invoke(ThreadContext context,
                          IRubyObject self,
                          java.lang.String name,
                          CallType callType,
                          Block block)

finvoke

public IRubyObject finvoke(ThreadContext context,
                           IRubyObject self,
                           java.lang.String name,
                           Block block)

invoke

public IRubyObject invoke(ThreadContext context,
                          IRubyObject self,
                          java.lang.String name,
                          IRubyObject[] args,
                          CallType callType,
                          Block block)

finvoke

public IRubyObject finvoke(ThreadContext context,
                           IRubyObject self,
                           java.lang.String name,
                           IRubyObject[] args,
                           Block block)

invoke

public IRubyObject invoke(ThreadContext context,
                          IRubyObject self,
                          java.lang.String name,
                          IRubyObject arg,
                          CallType callType,
                          Block block)

finvoke

public IRubyObject finvoke(ThreadContext context,
                           IRubyObject self,
                           java.lang.String name,
                           IRubyObject arg,
                           Block block)

invoke

public IRubyObject invoke(ThreadContext context,
                          IRubyObject self,
                          java.lang.String name,
                          IRubyObject arg0,
                          IRubyObject arg1,
                          CallType callType,
                          Block block)

finvoke

public IRubyObject finvoke(ThreadContext context,
                           IRubyObject self,
                           java.lang.String name,
                           IRubyObject arg0,
                           IRubyObject arg1,
                           Block block)

invoke

public IRubyObject invoke(ThreadContext context,
                          IRubyObject self,
                          java.lang.String name,
                          IRubyObject arg0,
                          IRubyObject arg1,
                          IRubyObject arg2,
                          CallType callType,
                          Block block)

finvoke

public IRubyObject finvoke(ThreadContext context,
                           IRubyObject self,
                           java.lang.String name,
                           IRubyObject arg0,
                           IRubyObject arg1,
                           IRubyObject arg2,
                           Block block)

invoke

public IRubyObject invoke(ThreadContext context,
                          IRubyObject self,
                          java.lang.String name,
                          CallType callType)

finvoke

public IRubyObject finvoke(ThreadContext context,
                           IRubyObject self,
                           java.lang.String name)

finvokeChecked

public IRubyObject finvokeChecked(ThreadContext context,
                                  IRubyObject self,
                                  java.lang.String name)

invoke

public IRubyObject invoke(ThreadContext context,
                          IRubyObject self,
                          java.lang.String name,
                          IRubyObject[] args,
                          CallType callType)

finvoke

public IRubyObject finvoke(ThreadContext context,
                           IRubyObject self,
                           java.lang.String name,
                           IRubyObject[] args)

invoke

public IRubyObject invoke(ThreadContext context,
                          IRubyObject self,
                          java.lang.String name,
                          IRubyObject arg,
                          CallType callType)

finvoke

public IRubyObject finvoke(ThreadContext context,
                           IRubyObject self,
                           java.lang.String name,
                           IRubyObject arg)

invoke

public IRubyObject invoke(ThreadContext context,
                          IRubyObject self,
                          java.lang.String name,
                          IRubyObject arg0,
                          IRubyObject arg1,
                          CallType callType)

finvoke

public IRubyObject finvoke(ThreadContext context,
                           IRubyObject self,
                           java.lang.String name,
                           IRubyObject arg0,
                           IRubyObject arg1)

invoke

public IRubyObject invoke(ThreadContext context,
                          IRubyObject self,
                          java.lang.String name,
                          IRubyObject arg0,
                          IRubyObject arg1,
                          IRubyObject arg2,
                          CallType callType)

finvoke

public IRubyObject finvoke(ThreadContext context,
                           IRubyObject self,
                           java.lang.String name,
                           IRubyObject arg0,
                           IRubyObject arg1,
                           IRubyObject arg2)

invokeInherited

public IRubyObject invokeInherited(ThreadContext context,
                                   IRubyObject self,
                                   IRubyObject subclass)

newInstance

public IRubyObject newInstance(ThreadContext context,
                               Block block)
rb_class_new_instance


newInstance

public IRubyObject newInstance(ThreadContext context,
                               IRubyObject arg0,
                               Block block)

newInstance

public IRubyObject newInstance(ThreadContext context,
                               IRubyObject arg0,
                               IRubyObject arg1,
                               Block block)

newInstance

public IRubyObject newInstance(ThreadContext context,
                               IRubyObject arg0,
                               IRubyObject arg1,
                               IRubyObject arg2,
                               Block block)

newInstance

public IRubyObject newInstance(ThreadContext context,
                               IRubyObject[] args,
                               Block block)

initialize

public IRubyObject initialize(ThreadContext context,
                              Block block)
rb_class_initialize


initialize

public IRubyObject initialize(ThreadContext context,
                              IRubyObject superObject,
                              Block block)

initialize19

public IRubyObject initialize19(ThreadContext context,
                                Block block)
Description copied from class: RubyModule
rb_mod_initialize

Overrides:
initialize19 in class RubyModule

initialize19

public IRubyObject initialize19(ThreadContext context,
                                IRubyObject superObject,
                                Block block)

initialize_copy

public IRubyObject initialize_copy(IRubyObject original)
rb_class_init_copy

Overrides:
initialize_copy in class RubyModule

setModuleSuperClass

protected void setModuleSuperClass(RubyClass superClass)

subclasses

public java.util.Collection<RubyClass> subclasses(boolean includeDescendants)

addSubclass

public void addSubclass(RubyClass subclass)
Add a new subclass to the weak set of subclasses. This version always constructs a new set to avoid having to synchronize against the set when iterating it for invalidation in invalidateCacheDescendants.

Parameters:
subclass - The subclass to add

removeSubclass

public void removeSubclass(RubyClass subclass)
Remove a subclass from the weak set of subclasses.

Parameters:
subclass - The subclass to remove

replaceSubclass

public void replaceSubclass(RubyClass subclass,
                            RubyClass newSubclass)
Replace an existing subclass with a new one.

Parameters:
subclass - The subclass to remove
newSubclass - The subclass to replace it with

becomeSynchronized

public void becomeSynchronized()
Overrides:
becomeSynchronized in class RubyModule

invalidateCacheDescendants

public void invalidateCacheDescendants()
Invalidate all subclasses of this class by walking the set of all subclasses and asking them to invalidate themselves. Note that this version works against a reference to the current set of subclasses, which could be replaced by the time this iteration is complete. In theory, there may be a path by which invalidation would miss a class added during the invalidation process, but the exposure is minimal if it exists at all. The only way to prevent it would be to synchronize both invalidation and subclass set modification against a global lock, which we would like to avoid.

Overrides:
invalidateCacheDescendants in class RubyModule

getClassRuntime

public Ruby getClassRuntime()

getRealClass

public RubyClass getRealClass()

inherited

public IRubyObject inherited(ThreadContext context,
                             IRubyObject arg)

inherit

public void inherit(RubyClass superClazz)
rb_class_inherited (reversed semantics!)


superclass

public IRubyObject superclass(ThreadContext context)
Return the real super class of this class. rb_class_superclass


checkInheritable

public static void checkInheritable(IRubyObject superClass)
rb_check_inheritable


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

marshalTo

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

unmarshalFrom

public static RubyClass unmarshalFrom(UnmarshalStream input)
                               throws java.io.IOException
Throws:
java.io.IOException

isReifiable

public boolean isReifiable()
Whether this class can be reified into a Java class. Currently only objects that descend from Object (or descend from Ruby-based classes that descend from Object) can be reified.

Returns:
true if the class can be reified, false otherwise

reifyWithAncestors

public void reifyWithAncestors()
Reify this class, first reifying all its ancestors. This causes the reified class and all ancestors' reified classes to come into existence, so any future changes will not be reflected.


reifyWithAncestors

public void reifyWithAncestors(java.lang.String classDumpDir)
Reify this class, first reifying all its ancestors. This causes the reified class and all ancestors' reified classes to come into existence, so any future changes will not be reflected. This form also accepts a string argument indicating a path in which to dump the intermediate reified class bytes.

Parameters:
classDumpDir - the path in which to dump reified class bytes

reify

public void reify()

reify

public void reify(java.lang.String classDumpDir)
Stand up a real Java class for the backing store of this object

Parameters:
classDumpDir - Directory to save reified java class

setReifiedClass

public void setReifiedClass(java.lang.Class newReifiedClass)

getReifiedClass

public java.lang.Class getReifiedClass()

getParameterAnnotations

public java.util.Map<java.lang.String,java.util.List<java.util.Map<java.lang.Class,java.util.Map<java.lang.String,java.lang.Object>>>> getParameterAnnotations()

addParameterAnnotation

public void addParameterAnnotation(java.lang.String method,
                                   int i,
                                   java.lang.Class annoClass,
                                   java.util.Map<java.lang.String,java.lang.Object> value)

getMethodAnnotations

public java.util.Map<java.lang.String,java.util.Map<java.lang.Class,java.util.Map<java.lang.String,java.lang.Object>>> getMethodAnnotations()

addMethodAnnotation

public void addMethodAnnotation(java.lang.String methodName,
                                java.lang.Class annotation,
                                java.util.Map fields)

getMethodSignatures

public java.util.Map<java.lang.String,java.lang.Class[]> getMethodSignatures()

addMethodSignature

public void addMethodSignature(java.lang.String methodName,
                               java.lang.Class[] types)

getClassAnnotations

public java.util.Map<java.lang.Class,java.util.Map<java.lang.String,java.lang.Object>> getClassAnnotations()

addClassAnnotation

public void addClassAnnotation(java.lang.Class annotation,
                               java.util.Map fields)

toJava

public java.lang.Object toJava(java.lang.Class klass)
Description copied from interface: IRubyObject
Convert the object to the specified Java class, if possible.

Specified by:
toJava in interface IRubyObject
Overrides:
toJava in class RubyBasicObject
Parameters:
klass - The target type to which the object should be converted.
See Also:
IRubyObject.toJava

smartDump

public void smartDump(MarshalStream stream,
                      IRubyObject target)
               throws java.io.IOException
Marshal the given object to the marshaling stream, being "smart" and caching how to do that marshaling. If the class defines a custom "respond_to?" method, then the behavior of dumping could vary without our class structure knowing it. As a result, we do only the slow-path classic behavior. If the class defines a real "marshal_dump" method, we cache and use that. If the class defines a real "_dump" method, we cache and use that. If the class neither defines none of the above methods, we use a fast path directly to the default dumping logic.

Parameters:
stream - The stream to which to marshal the data
target - The object whose data should be marshaled
Throws:
java.io.IOException - If there is an IO exception while writing to the stream.

smartLoadNewUser

public IRubyObject smartLoadNewUser(IRubyObject target,
                                    IRubyObject data)
Load marshaled data into a blank target object using marshal_load, being "smart" and caching the mechanism for invoking marshal_load. If the class implements a custom respond_to?, cache nothing and go slow path invocation of respond_to? and marshal_load every time. Raise error if respond_to? :marshal_load returns true and no :marshal_load is defined. If the class implements marshal_load, cache and use that. Otherwise, error, since marshal_load is not present.

Parameters:
target - The blank target object into which marshal_load will deserialize the given data
data - The marshaled data
Returns:
The fully-populated target object

smartLoadOldUser

public IRubyObject smartLoadOldUser(IRubyObject data)
Load marshaled data into a blank target object using _load, being "smart" and caching the mechanism for invoking _load. If the metaclass implements custom respond_to?, cache nothing and go slow path invocation of respond_to? and _load every time. Raise error if respond_to? :_load returns true and no :_load is defined. If the metaclass implements _load, cache and use that. Otherwise, error, since _load is not present.

Parameters:
data - The marshaled data, to be reconstituted into an object by _load
Returns:
The fully-populated target object

hasObjectID

public boolean hasObjectID()


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