public class MixinInMetaClass
extends Object
Manages the integration of mixin classes into expandable metaclasses.
Associates a mixin class with instances of an expandable metaclass, enabling per-instance mixin functionality. Handles mixin instance creation and registration of mixin methods/properties.
| Type Params | Return Type | Name and description |
|---|---|---|
|
public boolean |
equals(Object that)Checks equality with another object based on the expandable metaclass and mixin class. |
|
public CachedClass |
getInstanceClass()Returns the cached class for the expandable metaclass that owns this mixin. |
|
public CachedClass |
getMixinClass()Returns the cached class of the mixin class itself. |
|
public Object |
getMixinInstance(Object object)Returns or creates a mixin instance for the given object. |
|
public int |
hashCode()Returns the hash code based on the mixin class. |
|
public static void |
mixinClassesToMetaClass(MetaClass self, List<Class> categoryClasses)Integrates mixin classes into the specified metaclass. |
|
public void |
setMixinInstance(Object object, Object mixinInstance)Sets or clears the mixin instance associated with an object. |
Checks equality with another object based on the expandable metaclass and mixin class.
that - the object to compare withtrue if this mixin represents the same metaclass and mixin; false otherwiseReturns the cached class for the expandable metaclass that owns this mixin.
Returns the cached class of the mixin class itself.
Returns or creates a mixin instance for the given object. Creates a new mixin instance on first access, then caches and reuses it for the same object.
object - the object to associate with a mixin instanceReturns the hash code based on the mixin class.
ExpandoMetaClass dedupes mixins (GROOVY-11775) through a
CopyOnWriteArraySet, which compares with
equals alone, so this must stay consistent with it rather than
being relied upon for that deduplication.
Integrates mixin classes into the specified metaclass. Each mixin class provides methods that are mixed into the target class.
self - the metaclass to mix methods intocategoryClasses - the classes providing mixin methods Sets or clears the mixin instance associated with an object.
Pass null to remove the mixin association.
object - the object to associate or disassociate with a mixinmixinInstance - the mixin instance to associate, or null to clear