Return type | Name and parameters |
---|---|
URL
|
getLocation()
Gets the url of the jar file/source file containing the specified class |
MetaClass
|
getMetaClass()
Adds a "metaClass" property to all class objects so you can use the syntax String.metaClass.myMethod = { println "foo" }
|
boolean
|
isCase(Object switchValue)
Special 'Case' implementation for Class, which allows testing whether some switch value is assignable from the given case class. |
MetaClass
|
metaClass(Closure closure)
Sets/updates the metaclass for a given class to a closure. |
void
|
mixin(Class categoryClass)
Extend class globally with category methods. |
void
|
mixin(Class[] categoryClass)
Extend class globally with category methods. |
void
|
mixin(List categoryClasses)
Extend class globally with category methods. |
Object
|
newInstance()
Convenience method to dynamically create a new instance of this class. |
Object
|
newInstance(Object[] args)
Helper to construct a new instance from the given arguments. |
void
|
setMetaClass(MetaClass metaClass)
Sets the metaclass for a given class. |
addShutdownHook
, any
, any
, asBoolean
, asType
, collect
, collect
, collect
, dump
, each
, eachMatch
, eachMatch
, eachWithIndex
, every
, every
, find
, find
, findAll
, findAll
, findIndexOf
, findIndexOf
, findIndexValues
, findIndexValues
, findLastIndexOf
, findLastIndexOf
, findResult
, findResult
, getAt
, getMetaClass
, getMetaPropertyValues
, getProperties
, grep
, grep
, hasProperty
, identity
, inject
, inject
, inspect
, invokeMethod
, is
, isCase
, iterator
, metaClass
, print
, print
, printf
, printf
, println
, println
, println
, putAt
, respondsTo
, respondsTo
, setMetaClass
, split
, sprintf
, sprintf
, stream
, tap
, toString
, use
, use
, use
, with
, with
, withCloseable
, withStream
, withTraits
Gets the url of the jar file/source file containing the specified class
null
if the specified class is from JDKAdds a "metaClass" property to all class objects so you can use the syntax
String.metaClass.myMethod = { println "foo" }
Special 'Case' implementation for Class, which allows testing
whether some switch value is assignable from the given case class.
If the switch value is an object, isCase
will return true if the
switch value is assignment compatible with the class (case value),
i.e. is an instanceof
the class, for example:
def someList = [] switch (someList) { case List: assert true : 'is a list' break case Map: assert false : 'is not a Map' break default: assert false : 'should never get here' break }If the switch value is a class,
isCase
will return true if the
switch value is assignable from the given class (case value), i.e. the case class
is the same as, or a superclass, or a super-interface of the switch class, for example:
switch (ArrayList) { case List: assert true : 'is a list' break case Map: assert false : 'is not a Map' break default: assert false : 'should never get here' break }
switchValue
- the switch valueSets/updates the metaclass for a given class to a closure.
closure
- the closure representing the new metaclassExtend class globally with category methods.
categoryClass
- a category class to useExtend class globally with category methods.
categoryClass
- a category class to useExtend class globally with category methods. All methods for given class and all super classes will be added to the class.
categoryClasses
- a category classes to useConvenience method to dynamically create a new instance of this class. Calls the default constructor.
Helper to construct a new instance from the given arguments.
The constructor is called based on the number and types in the
args array. Use newInstance(null)
or simply
newInstance()
for the default (no-arg) constructor.
args
- the constructor argumentsSets the metaclass for a given class.
metaClass
- the new MetaClass