Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

The attached script can lookup both Java and Groovy's meta methods and quickly display the method signatures.

Usage and Examples

Help

Code Block
none
none
$ groovy gdoc
usage gdoc className -- display all public methods signatures.
usage gdoc package.className -- same as above with full package prefix.
usage gdoc className methodName -- display only methods that match this name.

All public methods

Code Block
none
none
 groovy gdoc File
equals
  public boolean java.lang.Object.equals(java.lang.Object)
  public boolean java.io.File.equals(java.lang.Object)
getClass
  public final native java.lang.Class java.lang.Object.getClass()
hashCode
  public native int java.lang.Object.hashCode()
  public int java.io.File.hashCode()
notify
  public final native void java.lang.Object.notify()
notifyAll
  public final native void java.lang.Object.notifyAll()
toString
  public java.lang.String java.lang.Object.toString()
  public java.lang.String java.io.File.toString()
wait
  public final void java.lang.Object.wait() throws java.lang.InterruptedException
  public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException
  public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException
canRead
  public boolean java.io.File.canRead()
canWrite
  public boolean java.io.File.canWrite()
compareTo
  public int java.io.File.compareTo(java.io.File)
  public volatile int java.io.File.compareTo(java.lang.Object)
createNewFile
  public boolean java.io.File.createNewFile() throws java.io.IOException
createTempFile
  public static java.io.File java.io.File.createTempFile(java.lang.String,java.lang.String) throws java.io.IOException
  public static java.io.File java.io.File.createTempFile(java.lang.String,java.lang.String,java.io.File) throws java.io.IOException
delete
  public boolean java.io.File.delete()
deleteOnExit
  public void java.io.File.deleteOnExit()
exists
  public boolean java.io.File.exists()
getAbsoluteFile
  public java.io.File java.io.File.getAbsoluteFile()
getAbsolutePath
  public java.lang.String java.io.File.getAbsolutePath()
getCanonicalFile
  public java.io.File java.io.File.getCanonicalFile() throws java.io.IOException
getCanonicalPath
  public java.lang.String java.io.File.getCanonicalPath() throws java.io.IOException
getName
  public java.lang.String java.io.File.getName()
getParent
  public java.lang.String java.io.File.getParent()
getParentFile
  public java.io.File java.io.File.getParentFile()
... many more...

Filter method names(ones from JDK built-in)

Code Block
none
none
$ groovy gdoc File list
list
  public java.lang.String[] java.io.File.list()
  public java.lang.String[] java.io.File.list(java.io.FilenameFilter)
listFiles
  public java.io.File[] java.io.File.listFiles()
  public java.io.File[] java.io.File.listFiles(java.io.FileFilter)
  public java.io.File[] java.io.File.listFiles(java.io.FilenameFilter)
listRoots
  public static java.io.File[] java.io.File.listRoots()

Filter method names(ones from Groovy's Dynamic methods)

Code Block
none
none
$ groovy gdoc File each
eachFile
  public static void org.codehaus.groovy.runtime.DefaultGroovyMethods.eachFile(java.io.File,groovy.lang.Closure) throws java.io.FileNotFoundException,java.lang.IllegalArgumentException
each
  public static java.lang.Object org.codehaus.groovy.runtime.DefaultGroovyMethods.each(java.lang.Object,groovy.lang.Closure)
eachFileMatch
  public static void org.codehaus.groovy.runtime.DefaultGroovyMethods.eachFileMatch(java.io.File,java.lang.Object,groovy.lang.Closure) throws java.io.FileNotFoundException,java.lang.IllegalArgumentException
eachLine
  public static void org.codehaus.groovy.runtime.DefaultGroovyMethods.eachLine(java.io.File,groovy.lang.Closure) throws java.io.IOException
eachObject
  public static void org.codehaus.groovy.runtime.DefaultGroovyMethods.eachObject(java.io.File,groovy.lang.Closure) throws java.io.IOException,java.lang.ClassNotFoundException
eachDirRecurse
  public static void org.codehaus.groovy.runtime.DefaultGroovyMethods.eachDirRecurse(java.io.File,groovy.lang.Closure) throws java.io.FileNotFoundException,java.lang.IllegalArgumentException
eachFileRecurse
  public static void org.codehaus.groovy.runtime.DefaultGroovyMethods.eachFileRecurse(java.io.File,groovy.lang.Closure) throws java.io.FileNotFoundException,java.lang.IllegalArgumentException
eachDir
  public static void org.codehaus.groovy.runtime.DefaultGroovyMethods.eachDir(java.io.File,groovy.lang.Closure) throws java.io.FileNotFoundException,java.lang.IllegalArgumentException
eachByte
  public static void org.codehaus.groovy.runtime.DefaultGroovyMethods.eachByte(java.io.File,groovy.lang.Closure) throws java.io.IOException
eachDirMatch
  public static void org.codehaus.groovy.runtime.DefaultGroovyMethods.eachDirMatch(java.io.File,java.lang.Object,groovy.lang.Closure) throws java.io.FileNotFoundException,java.lang.IllegalArgumentException
eachWithIndex
  public static java.lang.Object org.codehaus.groovy.runtime.DefaultGroovyMethods.eachWithIndex(java.lang.Object,groovy.lang.Closure)

Using package prefix(any things that's outside of Groovy's default imports.)

Code Block
none
none
 groovy gdoc groovy.sql.Sql each
eachRow
  public void groovy.sql.Sql.eachRow(groovy.lang.GString,groovy.lang.Closure) throws java.sql.SQLException
  public void groovy.sql.Sql.eachRow(java.lang.String,groovy.lang.Closure) throws java.sql.SQLException
  public void groovy.sql.Sql.eachRow(java.lang.String,groovy.lang.Closure,groovy.lang.Closure) throws java.sql.SQLException
  public void groovy.sql.Sql.eachRow(java.lang.String,java.util.List,groovy.lang.Closure) throws java.sql.SQLException
each
  public static java.lang.Object org.codehaus.groovy.runtime.DefaultGroovyMethods.each(java.lang.Object,groovy.lang.Closure)
eachWithIndex
  public static java.lang.Object org.codehaus.groovy.runtime.DefaultGroovyMethods.eachWithIndex(java.lang.Object,groovy.lang.Closure)