|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object groovy.lang.MetaClassImpl
public class MetaClassImpl extends java.lang.Object
Allows methods to be dynamically added to existing classes at runtime
Nested Class Summary | |
---|---|
static class |
MetaClassImpl.Index
|
Field Summary | |
---|---|
protected static java.lang.String |
INVOKE_METHOD_METHOD
|
protected static java.lang.String |
METHOD_MISSING
|
protected static java.lang.String |
PROPERTY_MISSING
|
protected static java.lang.String |
STATIC_METHOD_MISSING
|
protected static java.lang.String |
STATIC_PROPERTY_MISSING
|
protected MetaMethod |
getPropertyMethod
|
protected MetaMethod |
invokeMethodMethod
|
protected boolean |
isGroovyObject
|
protected boolean |
isMap
|
protected MetaMethodIndex |
metaMethodIndex
|
protected MetaClassRegistry |
registry
|
protected MetaMethod |
setPropertyMethod
|
protected CachedClass |
theCachedClass
|
protected java.lang.Class |
theClass
|
Constructor Summary | |
MetaClassImpl(java.lang.Class theClass, MetaMethod[] add)
|
|
MetaClassImpl(java.lang.Class theClass)
|
|
MetaClassImpl(MetaClassRegistry registry, java.lang.Class theClass, MetaMethod[] add)
|
|
MetaClassImpl(MetaClassRegistry registry, java.lang.Class theClass)
|
Method Summary | |
---|---|
void
|
addMetaBeanProperty(MetaBeanProperty mp)
|
void
|
addMetaMethod(MetaMethod method)
@return the matching method which should be found |
protected void
|
addMetaMethodToIndex(MetaMethod method, Header header)
|
void
|
addNewInstanceMethod(java.lang.reflect.Method method)
|
void
|
addNewStaticMethod(java.lang.reflect.Method method)
|
protected void
|
applyPropertyDescriptors(java.beans.PropertyDescriptor[] propertyDescriptors)
|
protected void
|
checkIfGroovyObjectMethod(MetaMethod metaMethod)
Chooses the correct method to use from a list of methods which match by name. |
protected void
|
checkInitalised()
checks if the initialisation of the class id complete. |
protected java.lang.Object
|
chooseMethod(java.lang.String methodName, java.lang.Object methodOrList, java.lang.Class[] arguments)
|
protected void
|
clearInvocationCaches()
|
CallSite
|
createConstructorSite(CallSite site, java.lang.Object[] args)
|
CallSite
|
createPogoCallCurrentSite(CallSite site, java.lang.Class sender, java.lang.Object[] args)
|
CallSite
|
createPogoCallSite(CallSite site, java.lang.Object[] args)
|
CallSite
|
createPojoCallSite(CallSite site, java.lang.Object receiver, java.lang.Object[] args)
|
CallSite
|
createStaticSite(CallSite site, java.lang.Object[] args)
|
protected void
|
dropMethodCache(java.lang.String name)
|
protected void
|
dropStaticMethodCache(java.lang.String name)
|
protected static MetaMethod
|
findMethodInClassHierarchy(java.lang.Class instanceKlazz, java.lang.String methodName, java.lang.Class[] arguments, MetaClass metaClass)
remove all method call cache entries. |
protected MetaMethod
|
findMixinMethod(java.lang.String methodName, java.lang.Class[] arguments)
|
protected static MetaMethod
|
findOwnMethod(java.lang.Class instanceKlazz, java.lang.String methodName, java.lang.Class[] arguments, MetaClass metaClass, MetaMethod method)
|
protected MetaBeanProperty
|
findPropertyInClassHierarchy(java.lang.String propertyName, CachedClass theClass)
|
MetaMethod[]
|
getAdditionalMetaMethods()
|
java.lang.Object
|
getAttribute(java.lang.Class sender, java.lang.Object receiver, java.lang.String messageName, boolean useSuper)
|
java.lang.Object
|
getAttribute(java.lang.Class sender, java.lang.Object object, java.lang.String attribute, boolean useSuper, boolean fromInsideClass)
|
java.lang.Object
|
getAttribute(java.lang.Object object, java.lang.String attribute)
|
ClassInfo
|
getClassInfo()
|
ClassNode
|
getClassNode()
return false: add method null: ignore method true: replace |
MetaProperty
|
getEffectiveGetMetaProperty(java.lang.Class sender, java.lang.Object object, java.lang.String name, boolean useSuper)
todo these special cases should be special MetaClasses maybe |
MetaMethod
|
getMetaMethod(java.lang.String name, java.lang.Object[] argTypes)
@see MetaObjectProtocol#getMetaMethod(String, Object[]) |
java.util.List
|
getMetaMethods()
|
MetaProperty
|
getMetaProperty(java.lang.String name)
@see MetaObjectProtocol#getMetaProperty(String) |
MetaMethod
|
getMethodWithCaching(java.lang.Class sender, java.lang.String methodName, java.lang.Object[] arguments, boolean isCallToSuper)
|
MetaMethod
|
getMethodWithoutCaching(java.lang.Class sender, java.lang.String methodName, java.lang.Class[] arguments, boolean isCallToSuper)
|
java.util.List
|
getMethods()
|
java.util.List
|
getProperties()
|
java.lang.Object
|
getProperty(java.lang.Class sender, java.lang.Object object, java.lang.String name, boolean useSuper, boolean fromInsideClass)
|
java.lang.Object
|
getProperty(java.lang.Object object, java.lang.String property)
|
MetaClassRegistry
|
getRegistry()
|
MetaMethod
|
getStaticMetaMethod(java.lang.String name, java.lang.Object[] argTypes)
@see MetaObjectProtocol#getStaticMetaMethod(String, Object[]) |
protected java.lang.Object
|
getSubclassMetaMethods(java.lang.String methodName)
|
protected java.util.LinkedList
|
getSuperClasses()
|
CachedClass
|
getTheCachedClass()
|
java.lang.Class
|
getTheClass()
|
int
|
getVersion()
|
MetaProperty
|
hasProperty(java.lang.Object obj, java.lang.String name)
@see MetaObjectProtocol#hasProperty(Object,String) |
void
|
incVersion()
|
void
|
initialize()
|
java.lang.Object
|
invokeConstructor(java.lang.Object[] arguments)
|
java.lang.Object
|
invokeMethod(java.lang.Object object, java.lang.String methodName, java.lang.Object arguments)
|
java.lang.Object
|
invokeMethod(java.lang.Object object, java.lang.String methodName, java.lang.Object[] originalArguments)
Invokes the given method on the object. |
java.lang.Object
|
invokeMethod(java.lang.Class sender, java.lang.Object object, java.lang.String methodName, java.lang.Object[] originalArguments, boolean isCallToSuper, boolean fromInsideClass)
|
java.lang.Object
|
invokeMissingMethod(java.lang.Object instance, java.lang.String methodName, java.lang.Object[] arguments)
|
java.lang.Object
|
invokeMissingProperty(java.lang.Object instance, java.lang.String propertyName, java.lang.Object optionalValue, boolean isGetter)
|
java.lang.Object
|
invokeStaticMethod(java.lang.Object object, java.lang.String methodName, java.lang.Object[] arguments)
|
protected java.lang.Object
|
invokeStaticMissingProperty(java.lang.Object instance, java.lang.String propertyName, java.lang.Object optionalValue, boolean isGetter)
|
boolean
|
isGroovyObject()
|
protected boolean
|
isInitialized()
|
boolean
|
isModified()
|
protected void
|
onGetPropertyFoundInHierarchy(MetaMethod method)
|
protected void
|
onInvokeMethodFoundInHierarchy(MetaMethod method)
|
protected void
|
onMixinMethodFound(MetaMethod method)
|
protected void
|
onSetPropertyFoundInHierarchy(MetaMethod method)
|
protected void
|
onSuperMethodFoundInHierarchy(MetaMethod method)
|
protected void
|
onSuperPropertyFoundInHierarchy(MetaBeanProperty property)
|
MetaMethod
|
pickMethod(java.lang.String methodName, java.lang.Class[] arguments)
|
java.util.List
|
respondsTo(java.lang.Object obj, java.lang.String name, java.lang.Object[] argTypes)
@see MetaObjectProtocol#respondsTo(Object, String, Object[]) |
java.util.List
|
respondsTo(java.lang.Object obj, java.lang.String name)
@see MetaObjectProtocol#respondsTo(Object, String) |
java.lang.reflect.Constructor
|
retrieveConstructor(java.lang.Class[] arguments)
|
MetaMethod
|
retrieveStaticMethod(java.lang.String methodName, java.lang.Object[] arguments)
|
int
|
selectConstructorAndTransformArguments(int numberOfConstructors, java.lang.Object[] arguments)
|
void
|
setAttribute(java.lang.Class sender, java.lang.Object object, java.lang.String attribute, java.lang.Object newValue, boolean useSuper, boolean fromInsideClass)
|
void
|
setAttribute(java.lang.Object object, java.lang.String attribute, java.lang.Object newValue)
|
void
|
setProperties(java.lang.Object bean, java.util.Map map)
@return the given property's value on the object |
void
|
setProperty(java.lang.Class sender, java.lang.Object object, java.lang.String name, java.lang.Object newValue, boolean useSuper, boolean fromInsideClass)
|
void
|
setProperty(java.lang.Object object, java.lang.String property, java.lang.Object newValue)
|
java.lang.String
|
toString()
|
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Field Detail |
---|
protected static final java.lang.String INVOKE_METHOD_METHOD
protected static final java.lang.String METHOD_MISSING
protected static final java.lang.String PROPERTY_MISSING
protected static final java.lang.String STATIC_METHOD_MISSING
protected static final java.lang.String STATIC_PROPERTY_MISSING
protected MetaMethod getPropertyMethod
protected MetaMethod invokeMethodMethod
protected final boolean isGroovyObject
protected final boolean isMap
protected final MetaMethodIndex metaMethodIndex
protected MetaClassRegistry registry
protected MetaMethod setPropertyMethod
protected final CachedClass theCachedClass
protected final java.lang.Class theClass
Constructor Detail |
---|
public MetaClassImpl(java.lang.Class theClass, MetaMethod[] add)
public MetaClassImpl(java.lang.Class theClass)
public MetaClassImpl(MetaClassRegistry registry, java.lang.Class theClass, MetaMethod[] add)
public MetaClassImpl(MetaClassRegistry registry, java.lang.Class theClass)
Method Detail |
---|
public void addMetaBeanProperty(MetaBeanProperty mp)
public void addMetaMethod(MetaMethod method)
protected void addMetaMethodToIndex(MetaMethod method, Header header)
public void addNewInstanceMethod(java.lang.reflect.Method method)
public void addNewStaticMethod(java.lang.reflect.Method method)
protected void applyPropertyDescriptors(java.beans.PropertyDescriptor[] propertyDescriptors)
protected final void checkIfGroovyObjectMethod(MetaMethod metaMethod)
methodOrList
- the possible methods to choose from
protected void checkInitalised()
protected java.lang.Object chooseMethod(java.lang.String methodName, java.lang.Object methodOrList, java.lang.Class[] arguments)
protected void clearInvocationCaches()
public CallSite createConstructorSite(CallSite site, java.lang.Object[] args)
public CallSite createPogoCallCurrentSite(CallSite site, java.lang.Class sender, java.lang.Object[] args)
public CallSite createPogoCallSite(CallSite site, java.lang.Object[] args)
public CallSite createPojoCallSite(CallSite site, java.lang.Object receiver, java.lang.Object[] args)
public CallSite createStaticSite(CallSite site, java.lang.Object[] args)
protected void dropMethodCache(java.lang.String name)
protected void dropStaticMethodCache(java.lang.String name)
protected static MetaMethod findMethodInClassHierarchy(java.lang.Class instanceKlazz, java.lang.String methodName, java.lang.Class[] arguments, MetaClass metaClass)
protected MetaMethod findMixinMethod(java.lang.String methodName, java.lang.Class[] arguments)
protected static MetaMethod findOwnMethod(java.lang.Class instanceKlazz, java.lang.String methodName, java.lang.Class[] arguments, MetaClass metaClass, MetaMethod method)
protected MetaBeanProperty findPropertyInClassHierarchy(java.lang.String propertyName, CachedClass theClass)
public MetaMethod[] getAdditionalMetaMethods()
public java.lang.Object getAttribute(java.lang.Class sender, java.lang.Object receiver, java.lang.String messageName, boolean useSuper)
public java.lang.Object getAttribute(java.lang.Class sender, java.lang.Object object, java.lang.String attribute, boolean useSuper, boolean fromInsideClass)
public java.lang.Object getAttribute(java.lang.Object object, java.lang.String attribute)
public ClassInfo getClassInfo()
public ClassNode getClassNode()
public MetaProperty getEffectiveGetMetaProperty(java.lang.Class sender, java.lang.Object object, java.lang.String name, boolean useSuper)
public MetaMethod getMetaMethod(java.lang.String name, java.lang.Object[] argTypes)
public java.util.List getMetaMethods()
public MetaProperty getMetaProperty(java.lang.String name)
public MetaMethod getMethodWithCaching(java.lang.Class sender, java.lang.String methodName, java.lang.Object[] arguments, boolean isCallToSuper)
public MetaMethod getMethodWithoutCaching(java.lang.Class sender, java.lang.String methodName, java.lang.Class[] arguments, boolean isCallToSuper)
public java.util.List getMethods()
public java.util.List getProperties()
public java.lang.Object getProperty(java.lang.Class sender, java.lang.Object object, java.lang.String name, boolean useSuper, boolean fromInsideClass)
public java.lang.Object getProperty(java.lang.Object object, java.lang.String property)
public MetaClassRegistry getRegistry()
public MetaMethod getStaticMetaMethod(java.lang.String name, java.lang.Object[] argTypes)
protected java.lang.Object getSubclassMetaMethods(java.lang.String methodName)
protected java.util.LinkedList getSuperClasses()
public final CachedClass getTheCachedClass()
public java.lang.Class getTheClass()
public int getVersion()
public MetaProperty hasProperty(java.lang.Object obj, java.lang.String name)
public void incVersion()
public void initialize()
public java.lang.Object invokeConstructor(java.lang.Object[] arguments)
public java.lang.Object invokeMethod(java.lang.Object object, java.lang.String methodName, java.lang.Object arguments)
public java.lang.Object invokeMethod(java.lang.Object object, java.lang.String methodName, java.lang.Object[] originalArguments)
public java.lang.Object invokeMethod(java.lang.Class sender, java.lang.Object object, java.lang.String methodName, java.lang.Object[] originalArguments, boolean isCallToSuper, boolean fromInsideClass)
public java.lang.Object invokeMissingMethod(java.lang.Object instance, java.lang.String methodName, java.lang.Object[] arguments)
public java.lang.Object invokeMissingProperty(java.lang.Object instance, java.lang.String propertyName, java.lang.Object optionalValue, boolean isGetter)
public java.lang.Object invokeStaticMethod(java.lang.Object object, java.lang.String methodName, java.lang.Object[] arguments)
protected java.lang.Object invokeStaticMissingProperty(java.lang.Object instance, java.lang.String propertyName, java.lang.Object optionalValue, boolean isGetter)
public boolean isGroovyObject()
protected boolean isInitialized()
public boolean isModified()
protected void onGetPropertyFoundInHierarchy(MetaMethod method)
protected void onInvokeMethodFoundInHierarchy(MetaMethod method)
protected void onMixinMethodFound(MetaMethod method)
protected void onSetPropertyFoundInHierarchy(MetaMethod method)
protected void onSuperMethodFoundInHierarchy(MetaMethod method)
protected void onSuperPropertyFoundInHierarchy(MetaBeanProperty property)
public MetaMethod pickMethod(java.lang.String methodName, java.lang.Class[] arguments)
public java.util.List respondsTo(java.lang.Object obj, java.lang.String name, java.lang.Object[] argTypes)
public java.util.List respondsTo(java.lang.Object obj, java.lang.String name)
public java.lang.reflect.Constructor retrieveConstructor(java.lang.Class[] arguments)
public MetaMethod retrieveStaticMethod(java.lang.String methodName, java.lang.Object[] arguments)
public int selectConstructorAndTransformArguments(int numberOfConstructors, java.lang.Object[] arguments)
public void setAttribute(java.lang.Class sender, java.lang.Object object, java.lang.String attribute, java.lang.Object newValue, boolean useSuper, boolean fromInsideClass)
public void setAttribute(java.lang.Object object, java.lang.String attribute, java.lang.Object newValue)
public void setProperties(java.lang.Object bean, java.util.Map map)
public void setProperty(java.lang.Class sender, java.lang.Object object, java.lang.String name, java.lang.Object newValue, boolean useSuper, boolean fromInsideClass)
public void setProperty(java.lang.Object object, java.lang.String property, java.lang.Object newValue)
public java.lang.String toString()
Groovy Documentation