| 
 | Groovy 2.2.0 | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||
java.lang.Objectgroovy.lang.GrabConfig
@Retention(RetentionPolicy.SOURCE)
@Target({
        ElementType.CONSTRUCTOR,
        ElementType.FIELD,
        ElementType.LOCAL_VARIABLE,
        ElementType.METHOD,
        ElementType.PARAMETER,
        ElementType.TYPE})
public @interface GrabConfig
Used to modify the grape configuration for grab requests.
An example involving databases:
Another example involving XStream:@Grab('mysql:mysql-connector-java:5.1.6'),@GrabConfig(systemClassLoader=true) import groovy.sql.Sql def sql=Sql.newInstance("jdbc:mysql://localhost/test", "user", "password", "com.mysql.jdbc.Driver") println sql.firstRow('SELECT * FROM INFORMATION_SCHEMA.COLUMNS')
@Grapes([@Grab('com.thoughtworks.xstream:xstream:1.3.1'),@Grab('xpp3:xpp3_min:1.1.4c'),@GrabConfig(systemClassLoader=true, initContextClassLoader=true) ]) import com.thoughtworks.xstream.* class Staff { String firstname, lastname, position } def xstream = new XStream() def john1 = new Staff(firstname:'John', lastname:'Connor', position:'Resistance Leader') // write out to XML file new File("john.xml").withOutputStream { out -> xstream.toXML(john1, out) } // now read back in def john2 new File("john.xml").withInputStream { ins -> john2 = xstream.fromXML(ins) } println john2.dump()
Further information about customising grape behavior can be found on the Grape documentation page: http://groovy.codehaus.org/Grape.
| Optional Element Summary | |
|---|---|
| boolean | autoDownloadSet to false if you want to disable automatic downloading of locally missing jars. | 
| boolean | disableChecksumsSet to true if you want to disable checksum checking. | 
| boolean | initContextClassLoaderSet to true if you want the context classloader to be initialised to the classloader of the current class or script. | 
| boolean | systemClassLoaderSet to true if you want to use the system classloader when loading the grape. | 
| Method Summary | 
|---|
| Methods inherited from class Object | |
|---|---|
| wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll | 
| Element Detail | 
|---|
public boolean autoDownload
public boolean disableChecksums
public boolean initContextClassLoader
public boolean systemClassLoader
Copyright © 2003-2013 The Codehaus. All rights reserved.