org.jruby
Class IncludedModuleWrapper

java.lang.Object
  extended byorg.jruby.RubyObject
      extended byorg.jruby.RubyModule
          extended byorg.jruby.RubyClass
              extended byorg.jruby.IncludedModuleWrapper
All Implemented Interfaces:
java.lang.Cloneable, IRubyObject

public final class IncludedModuleWrapper
extends RubyClass

This class is used to provide an intermediate superclass for modules and classes that include other modules. It inserts itself as the immediate superClass of the includer, but defers all module methods to the actual superclass. Multiple of these intermediate superclasses can be added for multiple included modules. This allows the normal superclass-based searches (searchMethod, getConstant, etc) to traverse the superclass ancestors as normal while the included modules do not actually show up in direct inheritance traversal.

See Also:
RubyModule

Nested Class Summary
 
Nested classes inherited from class org.jruby.RubyObject
RubyObject.Finalizer
 
Field Summary
 
Fields inherited from class org.jruby.RubyClass
EQQ_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
IncludedModuleWrapper(Ruby runtime, RubyClass superClass, RubyModule delegate)
           
 
Method Summary
 java.util.Map getInstanceVariables()
           
 java.util.Map getMethods()
           
 java.lang.String getName()
          Generate a fully-qualified class name or a #-style name for anonymous and singleton classes.
 RubyModule getNonIncludedClass()
           
 RubyClass getRealClass()
           
 RubyFixnum id()
          We don't want to reveal ourselves to Ruby code, so delegate this operation.
 boolean isClass()
           
 boolean isImmediate()
           
 boolean isIncluded()
          Is this module one that in an included one (e.g.
 boolean isModule()
           
 boolean isSame(RubyModule module)
           
 IncludedModuleWrapper newIncludeClass(RubyClass superClass)
          Overridden newIncludeClass implementation to allow attaching future includes to the correct module (i.e.
 void setInstanceVariables(java.util.Map newMethods)
           
 void setMetaClass(RubyClass newRubyClass)
           
 void setMethods(java.util.Map newMethods)
           
 
Methods inherited from class org.jruby.RubyClass
allocate, callMethod, cloneClass, createBootstrapMetaClass, createClassClass, doClone, getAllocator, getMarshal, getNativeTypeIndex, getRuntime, inherited, inherited, inheritedBy, initialize_copy, isSingleton, marshal, marshalTo, newClass, newClass, newClass, newClassClass, newInstance, newSubClass, newSubClass, setMarshal, subclass, superclass, unmarshal, unmarshalFrom
 
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, getParent, getSuperClass, hash, hashCode, hasModuleInHierarchy, include_p, include, included_modules, included, includeModule, initialize, instance_method, instance_methods, isClassVarDefined, isKindOfModule, isMethodBound, marshalTo, method_added, method_defined, method_removed, method_undefined, module_eval, module_function, name, nesting, 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, callMethodMissingIfNecessary, 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, getInstanceVariablesSnapshot, getJavaClass, getMetaClass, getSingletonClass, getSingletonClassClone, getType, id_deprecated, infectBy, inherited, initCopy, inspect, instance_eval, instance_exec, instance_of, instance_variable_get, instance_variable_set, instance_variables, instanceVariableNames, isFalse, isFrozen, 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, 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
 

Constructor Detail

IncludedModuleWrapper

public IncludedModuleWrapper(Ruby runtime,
                             RubyClass superClass,
                             RubyModule delegate)
Method Detail

newIncludeClass

public IncludedModuleWrapper newIncludeClass(RubyClass superClass)
Overridden newIncludeClass implementation to allow attaching future includes to the correct module (i.e. the one to which this is attached)

Overrides:
newIncludeClass in class RubyModule
Returns:
The module wrapper
See Also:
RubyModule.newIncludeClass(RubyClass)

isModule

public boolean isModule()
Overrides:
isModule in class RubyClass

isClass

public boolean isClass()
Overrides:
isClass in class RubyClass

isIncluded

public boolean isIncluded()
Description copied from class: RubyModule
Is this module one that in an included one (e.g. an IncludedModuleWrapper).

Overrides:
isIncluded in class RubyModule

isImmediate

public boolean isImmediate()
Specified by:
isImmediate in interface IRubyObject
Overrides:
isImmediate in class RubyObject

setMetaClass

public void setMetaClass(RubyClass newRubyClass)
Specified by:
setMetaClass in interface IRubyObject
Overrides:
setMetaClass in class RubyObject

getMethods

public java.util.Map getMethods()
Overrides:
getMethods in class RubyModule

setMethods

public void setMethods(java.util.Map newMethods)

getInstanceVariables

public java.util.Map getInstanceVariables()
Specified by:
getInstanceVariables in interface IRubyObject
Overrides:
getInstanceVariables in class RubyObject

setInstanceVariables

public void setInstanceVariables(java.util.Map newMethods)
Specified by:
setInstanceVariables in interface IRubyObject
Overrides:
setInstanceVariables in class RubyObject

getName

public java.lang.String getName()
Description copied from class: RubyModule
Generate a fully-qualified class name or a #-style name for anonymous and singleton classes. Ruby C equivalent = "classname"

Overrides:
getName in class RubyModule
Returns:
The generated class name

getNonIncludedClass

public RubyModule getNonIncludedClass()
Overrides:
getNonIncludedClass in class RubyModule

getRealClass

public RubyClass getRealClass()
Overrides:
getRealClass in class RubyClass

isSame

public boolean isSame(RubyModule module)
Overrides:
isSame in class RubyModule

id

public RubyFixnum id()
We don't want to reveal ourselves to Ruby code, so delegate this operation.

Specified by:
id in interface IRubyObject
Overrides:
id in class RubyObject


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