|
Groovy 2.2.0 | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object groovy.lang.MetaClassImpl
public class MetaClassImpl extends Object
Allows methods to be dynamically added to existing classes at runtime
Nested Class Summary | |
---|---|
static class |
MetaClassImpl.Index
|
static class |
MetaClassImpl.MetaConstructor
|
Field Summary | |
---|---|
static Object[] |
EMPTY_ARGUMENTS
|
protected static String |
INVOKE_METHOD_METHOD
|
protected static String |
METHOD_MISSING
|
protected static String |
PROPERTY_MISSING
|
protected static String |
STATIC_METHOD_MISSING
|
protected static 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 Class |
theClass
|
Constructor Summary | |
MetaClassImpl(Class theClass, MetaMethod[] add)
|
|
MetaClassImpl(Class theClass)
|
|
MetaClassImpl(MetaClassRegistry registry, Class theClass, MetaMethod[] add)
|
|
MetaClassImpl(MetaClassRegistry registry, Class theClass)
|
Method Summary | |
---|---|
void
|
addMetaBeanProperty(MetaBeanProperty mp)
|
void
|
addMetaMethod(MetaMethod method)
|
protected void
|
addMetaMethodToIndex(MetaMethod method, Header header)
|
void
|
addNewInstanceMethod(Method method)
|
void
|
addNewStaticMethod(Method method)
|
protected void
|
applyPropertyDescriptors(PropertyDescriptor[] propertyDescriptors)
|
protected void
|
checkIfGroovyObjectMethod(MetaMethod metaMethod)
|
protected void
|
checkInitalised()
|
protected Object
|
chooseMethod(String methodName, Object methodOrList, Class[] arguments)
|
protected void
|
clearInvocationCaches()
|
CallSite
|
createConstructorSite(CallSite site, Object[] args)
|
CallSite
|
createPogoCallCurrentSite(CallSite site, Class sender, Object[] args)
|
CallSite
|
createPogoCallSite(CallSite site, Object[] args)
|
CallSite
|
createPojoCallSite(CallSite site, Object receiver, Object[] args)
|
CallSite
|
createStaticSite(CallSite site, Object[] args)
|
protected void
|
dropMethodCache(String name)
|
protected void
|
dropStaticMethodCache(String name)
|
protected static MetaMethod
|
findMethodInClassHierarchy(Class instanceKlazz, String methodName, Class[] arguments, MetaClass metaClass)
|
protected MetaMethod
|
findMixinMethod(String methodName, Class[] arguments)
remove all method call cache entries. |
protected static MetaMethod
|
findOwnMethod(Class instanceKlazz, String methodName, Class[] arguments, MetaClass metaClass, MetaMethod method)
|
protected MetaBeanProperty
|
findPropertyInClassHierarchy(String propertyName, CachedClass theClass)
|
MetaMethod[]
|
getAdditionalMetaMethods()
|
Object
|
getAttribute(Class sender, Object receiver, String messageName, boolean useSuper)
|
Object
|
getAttribute(Class sender, Object object, String attribute, boolean useSuper, boolean fromInsideClass)
|
Object
|
getAttribute(Object object, String attribute)
|
ClassInfo
|
getClassInfo()
|
ClassNode
|
getClassNode()
return false: add method null: ignore method true: replace |
MetaProperty
|
getEffectiveGetMetaProperty(Class sender, Object object, String name, boolean useSuper)
todo these special cases should be special MetaClasses maybe |
MetaMethod
|
getMetaMethod(String name, Object[] argTypes)
@see MetaObjectProtocol#getMetaMethod(String, Object[]) |
List
|
getMetaMethods()
|
MetaProperty
|
getMetaProperty(String name)
@see MetaObjectProtocol#getMetaProperty(String) |
MetaMethod
|
getMethodWithCaching(Class sender, String methodName, Object[] arguments, boolean isCallToSuper)
|
MetaMethod
|
getMethodWithoutCaching(Class sender, String methodName, Class[] arguments, boolean isCallToSuper)
|
List
|
getMethods()
|
List
|
getProperties()
|
Object
|
getProperty(Class sender, Object object, String name, boolean useSuper, boolean fromInsideClass)
|
Object
|
getProperty(Object object, String property)
|
MetaClassRegistry
|
getRegistry()
|
MetaMethod
|
getStaticMetaMethod(String name, Object[] argTypes)
@see MetaObjectProtocol#getStaticMetaMethod(String, Object[]) |
protected Object
|
getSubclassMetaMethods(String methodName)
|
protected LinkedList
|
getSuperClasses()
|
CachedClass
|
getTheCachedClass()
|
Class
|
getTheClass()
|
int
|
getVersion()
|
MetaProperty
|
hasProperty(Object obj, String name)
@see MetaObjectProtocol#hasProperty(Object,String) |
void
|
incVersion()
|
void
|
initialize()
|
Object
|
invokeConstructor(Object[] arguments)
|
Object
|
invokeMethod(Object object, String methodName, Object arguments)
|
Object
|
invokeMethod(Object object, String methodName, Object[] originalArguments)
Invokes the given method on the object. |
Object
|
invokeMethod(Class sender, Object object, String methodName, Object[] originalArguments, boolean isCallToSuper, boolean fromInsideClass)
|
Object
|
invokeMissingMethod(Object instance, String methodName, Object[] arguments)
|
Object
|
invokeMissingProperty(Object instance, String propertyName, Object optionalValue, boolean isGetter)
|
Object
|
invokeStaticMethod(Object object, String methodName, Object[] arguments)
|
protected Object
|
invokeStaticMissingProperty(Object instance, String propertyName, 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(String methodName, Class[] arguments)
|
List
|
respondsTo(Object obj, String name, Object[] argTypes)
@see MetaObjectProtocol#respondsTo(Object, String, Object[]) |
List
|
respondsTo(Object obj, String name)
@see MetaObjectProtocol#respondsTo(Object, String) |
Constructor
|
retrieveConstructor(Class[] arguments)
|
MetaMethod
|
retrieveConstructor(Object[] arguments)
|
MetaMethod
|
retrieveStaticMethod(String methodName, Object[] arguments)
|
int
|
selectConstructorAndTransformArguments(int numberOfConstructors, Object[] arguments)
|
void
|
setAttribute(Class sender, Object object, String attribute, Object newValue, boolean useSuper, boolean fromInsideClass)
|
void
|
setAttribute(Object object, String attribute, Object newValue)
|
void
|
setProperties(Object bean, Map map)
|
void
|
setProperty(Class sender, Object object, String name, Object newValue, boolean useSuper, boolean fromInsideClass)
|
void
|
setProperty(Object object, String property, Object newValue)
|
String
|
toString()
@return the matching method which should be found |
Methods inherited from class Object | |
---|---|
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Field Detail |
---|
public static final Object[] EMPTY_ARGUMENTS
protected static final String INVOKE_METHOD_METHOD
protected static final String METHOD_MISSING
protected static final String PROPERTY_MISSING
protected static final String STATIC_METHOD_MISSING
protected static final 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 Class theClass
Constructor Detail |
---|
public MetaClassImpl(Class theClass, MetaMethod[] add)
public MetaClassImpl(Class theClass)
public MetaClassImpl(MetaClassRegistry registry, Class theClass, MetaMethod[] add)
public MetaClassImpl(MetaClassRegistry registry, Class theClass)
Method Detail |
---|
public void addMetaBeanProperty(MetaBeanProperty mp)
public void addMetaMethod(MetaMethod method)
protected void addMetaMethodToIndex(MetaMethod method, Header header)
public void addNewInstanceMethod(Method method)
public void addNewStaticMethod(Method method)
protected void applyPropertyDescriptors(PropertyDescriptor[] propertyDescriptors)
protected final void checkIfGroovyObjectMethod(MetaMethod metaMethod)
protected void checkInitalised()
protected Object chooseMethod(String methodName, Object methodOrList, Class[] arguments)
protected void clearInvocationCaches()
public CallSite createConstructorSite(CallSite site, Object[] args)
public CallSite createPogoCallCurrentSite(CallSite site, Class sender, Object[] args)
public CallSite createPogoCallSite(CallSite site, Object[] args)
public CallSite createPojoCallSite(CallSite site, Object receiver, Object[] args)
public CallSite createStaticSite(CallSite site, Object[] args)
protected void dropMethodCache(String name)
protected void dropStaticMethodCache(String name)
protected static MetaMethod findMethodInClassHierarchy(Class instanceKlazz, String methodName, Class[] arguments, MetaClass metaClass)
protected MetaMethod findMixinMethod(String methodName, Class[] arguments)
protected static MetaMethod findOwnMethod(Class instanceKlazz, String methodName, Class[] arguments, MetaClass metaClass, MetaMethod method)
protected MetaBeanProperty findPropertyInClassHierarchy(String propertyName, CachedClass theClass)
public MetaMethod[] getAdditionalMetaMethods()
public Object getAttribute(Class sender, Object receiver, String messageName, boolean useSuper)
public Object getAttribute(Class sender, Object object, String attribute, boolean useSuper, boolean fromInsideClass)
public Object getAttribute(Object object, String attribute)
public ClassInfo getClassInfo()
public ClassNode getClassNode()
public MetaProperty getEffectiveGetMetaProperty(Class sender, Object object, String name, boolean useSuper)
public MetaMethod getMetaMethod(String name, Object[] argTypes)
public List getMetaMethods()
public MetaProperty getMetaProperty(String name)
public MetaMethod getMethodWithCaching(Class sender, String methodName, Object[] arguments, boolean isCallToSuper)
public MetaMethod getMethodWithoutCaching(Class sender, String methodName, Class[] arguments, boolean isCallToSuper)
public List getMethods()
public List getProperties()
public Object getProperty(Class sender, Object object, String name, boolean useSuper, boolean fromInsideClass)
public Object getProperty(Object object, String property)
public MetaClassRegistry getRegistry()
public MetaMethod getStaticMetaMethod(String name, Object[] argTypes)
protected Object getSubclassMetaMethods(String methodName)
protected LinkedList getSuperClasses()
public final CachedClass getTheCachedClass()
public Class getTheClass()
public int getVersion()
public MetaProperty hasProperty(Object obj, String name)
public void incVersion()
public void initialize()
public Object invokeConstructor(Object[] arguments)
public Object invokeMethod(Object object, String methodName, Object arguments)
public Object invokeMethod(Object object, String methodName, Object[] originalArguments)
public Object invokeMethod(Class sender, Object object, String methodName, Object[] originalArguments, boolean isCallToSuper, boolean fromInsideClass)
public Object invokeMissingMethod(Object instance, String methodName, Object[] arguments)
public Object invokeMissingProperty(Object instance, String propertyName, Object optionalValue, boolean isGetter)
public Object invokeStaticMethod(Object object, String methodName, Object[] arguments)
protected Object invokeStaticMissingProperty(Object instance, String propertyName, 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(String methodName, Class[] arguments)
public List respondsTo(Object obj, String name, Object[] argTypes)
public List respondsTo(Object obj, String name)
public Constructor retrieveConstructor(Class[] arguments)
public MetaMethod retrieveConstructor(Object[] arguments)
public MetaMethod retrieveStaticMethod(String methodName, Object[] arguments)
public int selectConstructorAndTransformArguments(int numberOfConstructors, Object[] arguments)
public void setAttribute(Class sender, Object object, String attribute, Object newValue, boolean useSuper, boolean fromInsideClass)
public void setAttribute(Object object, String attribute, Object newValue)
public void setProperties(Object bean, Map map)
public void setProperty(Class sender, Object object, String name, Object newValue, boolean useSuper, boolean fromInsideClass)
public void setProperty(Object object, String property, Object newValue)
public String toString()
Copyright © 2003-2013 The Codehaus. All rights reserved.