public class ExpandoMetaClass extends MetaClassImpl
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Modifiers | Name | Description |
---|---|---|
protected class |
ExpandoMetaClass.ExpandoMetaConstructor |
Handles the ability to use the left shift operator to append new constructors |
protected class |
ExpandoMetaClass.ExpandoMetaProperty |
Instances of this class are returned when using the << left shift operator. |
Modifiers | Name | Description |
---|---|---|
static String |
CONSTRUCTOR |
|
static String |
STATIC_QUALIFIER |
|
boolean |
inRegistry |
Fields inherited from class | Fields |
---|---|
class MetaClassImpl |
EMPTY_ARGUMENTS, INVOKE_METHOD_METHOD, METHOD_MISSING, PROPERTY_MISSING, STATIC_METHOD_MISSING, STATIC_PROPERTY_MISSING, getPropertyMethod, invokeMethodMethod, isGroovyObject, isMap, metaMethodIndex, registry, setPropertyMethod, theCachedClass, theClass |
Constructor and description |
---|
ExpandoMetaClass
(Class theClass, boolean register, boolean allowChangesAfterInit, MetaMethod[] add) |
ExpandoMetaClass
(MetaClassRegistry registry, Class theClass, boolean register, boolean allowChangesAfterInit, MetaMethod[] add) |
ExpandoMetaClass
(Class theClass) Constructs a new ExpandoMetaClass instance for the given class |
ExpandoMetaClass
(Class theClass, MetaMethod[] add) |
ExpandoMetaClass
(Class theClass, boolean register) Constructs a new ExpandoMetaClass instance for the given class optionally placing the MetaClass in the MetaClassRegistry automatically |
ExpandoMetaClass
(Class theClass, boolean register, MetaMethod[] add) |
ExpandoMetaClass
(Class theClass, boolean register, boolean allowChangesAfterInit) Constructs a new ExpandoMetaClass instance for the given class optionally placing the MetaClass in the MetaClassRegistry automatically |
Type | Name and description |
---|---|
void |
addMixinClass(MixinInMetaClass mixin) |
Object |
castToMixedType(Object obj, Class type) |
protected void |
checkInitalised() |
CallSite |
createConstructorSite(CallSite site, Object[] args) |
CallSite |
createPogoCallCurrentSite(CallSite site, Class sender, String name, Object[] args) |
CallSite |
createPogoCallSite(CallSite site, Object[] args) |
CallSite |
createPojoCallSite(CallSite site, Object receiver, Object[] args) |
CallSite |
createStaticSite(CallSite site, Object[] args) |
ExpandoMetaClass |
define(Closure closure) |
static void |
disableGlobally() Call to disable the global use of ExpandoMetaClass |
static void |
enableGlobally() Call to enable global use of global use of ExpandoMetaClass within the registry. |
MetaMethod |
findMixinMethod(String methodName, Class[] arguments) |
List<MetaMethod> |
getExpandoMethods() Returns a list of expando MetaMethod instances added to this ExpandoMetaClass |
Collection<MetaProperty> |
getExpandoProperties() Returns a list of MetaBeanProperty instances added to this ExpandoMetaClass |
Collection |
getExpandoSubclassMethods() |
Class |
getJavaClass() @return The Java class enhanced by this MetaClass |
MetaClass |
getMetaClass() |
MetaProperty |
getMetaProperty(String name) Looks up an existing MetaProperty by name |
List<MetaMethod> |
getMethods() Overrides the behavior of parent getMethods() method to make MetaClass aware of added Expando methods |
List<MetaProperty> |
getProperties() |
Object |
getProperty(String property) |
Object |
getProperty(Class sender, Object object, String name, boolean useSuper, boolean fromInsideClass) Overrides default implementation just in case getProperty method has been overridden by ExpandoMetaClass |
Object |
getProperty(Object object, String name) Overrides default implementation just in case getProperty method has been overridden by ExpandoMetaClass |
String |
getPropertyForSetter(String setterName) Returns a property name equivalent for the given setter name or null if it is not a getter |
protected Object |
getSubclassMetaMethods(String methodName) |
boolean |
hasCustomStaticInvokeMethod() |
boolean |
hasMetaMethod(String name, Class[] args) Checks whether a MetaMethod for the given name and arguments exists |
boolean |
hasMetaProperty(String name) Returns true if the MetaClass has the given property |
void |
initialize() |
Object |
invokeConstructor(Object[] arguments) |
Object |
invokeMethod(String name, Object args) |
Object |
invokeMethod(Class sender, Object object, String methodName, Object[] originalArguments, boolean isCallToSuper, boolean fromInsideClass) Overrides default implementation just in case invokeMethod has been overridden by ExpandoMetaClass |
Object |
invokeStaticMethod(Object object, String methodName, Object[] arguments) Overrides default implementation just in case a static invoke method has been set on ExpandoMetaClass |
protected boolean |
isInitialized() Checks if the meta class is initialized. |
boolean |
isModified() |
boolean |
isSetter(String name, CachedClass[] args) |
static boolean |
isValidExpandoProperty(String property) |
protected void |
onGetPropertyFoundInHierarchy(MetaMethod method) |
protected void |
onInvokeMethodFoundInHierarchy(MetaMethod method) |
protected void |
onSetPropertyFoundInHierarchy(MetaMethod method) |
protected void |
onSuperMethodFoundInHierarchy(MetaMethod method) |
protected void |
onSuperPropertyFoundInHierarchy(MetaBeanProperty property) |
protected void |
performOperationOnMetaClass(ExpandoMetaClass.Callable c) |
void |
refreshInheritedMethods(Set modifiedSuperExpandos) Called from ExpandoMetaClassCreationHandle in the registry if it exists to set up inheritance handling |
void |
registerBeanProperty(String property, Object newValue) Registers a new bean property |
void |
registerInstanceMethod(MetaMethod metaMethod) Registers a new instance method for the given method name and closure on this MetaClass |
void |
registerInstanceMethod(String name, Closure closure) |
protected void |
registerStaticMethod(String name, Closure callable) |
protected void |
registerStaticMethod(String name, Closure callable, Class[] paramTypes) Registers a new static method for the given method name and closure on this MetaClass |
void |
registerSubclassInstanceMethod(String name, Class klazz, Closure closure) |
void |
registerSubclassInstanceMethod(MetaMethod metaMethod) |
MetaMethod |
retrieveConstructor(Object[] args) |
protected void |
setInitialized(boolean b) |
void |
setMetaClass(MetaClass metaClass) |
void |
setProperty(String property, Object newValue) |
void |
setProperty(Class sender, Object object, String name, Object newValue, boolean useSuper, boolean fromInsideClass) Overrides default implementation just in case setProperty method has been overridden by ExpandoMetaClass |
Constructs a new ExpandoMetaClass instance for the given class
theClass
- The class that the MetaClass applies toConstructs a new ExpandoMetaClass instance for the given class optionally placing the MetaClass in the MetaClassRegistry automatically
theClass
- The class that the MetaClass applies toregister
- True if the MetaClass should be registered inside the MetaClassRegistry. This defaults to true and ExpandoMetaClass will effect all instances if changedConstructs a new ExpandoMetaClass instance for the given class optionally placing the MetaClass in the MetaClassRegistry automatically
theClass
- The class that the MetaClass applies toregister
- True if the MetaClass should be registered inside the MetaClassRegistry. This defaults to true and ExpandoMetaClass will effect all instances if changedallowChangesAfterInit
- Should the meta class be modifiable after initialization. Default is false.Call to disable the global use of ExpandoMetaClass
Call to enable global use of global use of ExpandoMetaClass within the registry. This has the advantage that inheritance will function correctly, but has a higher memory usage on the JVM than normal Groovy
Returns a list of expando MetaMethod instances added to this ExpandoMetaClass
Returns a list of MetaBeanProperty instances added to this ExpandoMetaClass
Looks up an existing MetaProperty by name
name
- The name of the MetaPropertyOverrides the behavior of parent getMethods() method to make MetaClass aware of added Expando methods
Overrides default implementation just in case getProperty method has been overridden by ExpandoMetaClass
Overrides default implementation just in case getProperty method has been overridden by ExpandoMetaClass
Returns a property name equivalent for the given setter name or null if it is not a getter
setterName
- The setter nameChecks whether a MetaMethod for the given name and arguments exists
name
- The name of the MetaMethodargs
- The arguments to the meta methodReturns true if the MetaClass has the given property
name
- The name of the MetaPropertyOverrides default implementation just in case invokeMethod has been overridden by ExpandoMetaClass
Overrides default implementation just in case a static invoke method has been set on ExpandoMetaClass
Checks if the meta class is initialized.
Called from ExpandoMetaClassCreationHandle in the registry if it exists to set up inheritance handling
modifiedSuperExpandos
- A list of modified super ExpandoMetaClassRegisters a new bean property
property
- The property namenewValue
- The properties initial valueRegisters a new instance method for the given method name and closure on this MetaClass
Registers a new static method for the given method name and closure on this MetaClass
name
- The method namecallable
- The callable ClosureOverrides default implementation just in case setProperty method has been overridden by ExpandoMetaClass
Copyright © 2003-2015 The Apache Software Foundation. All rights reserved.