|
Groovy JDK |
Method Summary | |
---|---|
MetaClass
|
getMetaClass()
Adds a "metaClass" property to all class objects so you can use the syntax String.metaClass.myMethod = { println "foo" }
|
boolean
|
isCase(Object)
Special 'Case' implementation for Class, which allows testing for a certain class in a switch statement. |
MetaClass
|
metaClass(Closure)
Sets/updates the metaclass for a given class to a closure. |
void
|
mixin(List)
Extend class globally with category methods. |
void
|
mixin(Class)
Extend class globally with category methods. |
void
|
mixin(Class[])
Extend class globally with category methods. |
Object
|
newInstance()
Convenience method to dynamically create a new instance of this class. |
Object
|
newInstance(Object[])
Helper to construct a new instance from the given arguments. |
void
|
setMetaClass(MetaClass)
Sets the metaclass for a given class. |
Method Detail |
---|
public MetaClass getMetaClass()
String.metaClass.myMethod = { println "foo" }
public boolean isCase(Object)
switch( obj ) { case List : // obj is a list break; case Set : // etc }
switchValue
- the switch value.public MetaClass metaClass(Closure)
closure
- the closure representing the new metaclass.public void mixin(List)
categoryClasses
- a category classes to use.public void mixin(Class)
categoryClass
- a category class to use.public void mixin(Class[])
categoryClass
- a category class to use.public Object newInstance()
public Object newInstance(Object[])
newInstance(null)
or simply
newInstance()
for the default (no-arg) constructor.args
- the constructor arguments.public void setMetaClass(MetaClass)
metaClass
- the new MetaClass.
|
Groovy JDK |