Groovy's static import capability allows you to reference imported classes as if they were static methods in your own class. This is similar to Java's static import capability but works with Java 1.4 and above and is a little more dynamic than Java in that it allows you to define methods with the same name as an imported method as long as you have different types. If you have the same types, the imported class takes precedence. Here is a sample of its usage:
The first static import illustrates defining
LIGHT_GRAY as if it was defined locally as a static field.
The next two examples show renaming (called aliasing) of a method and a field respectively.
The final example illustrates wild-carding and selecting the locally defined
toHexString and imported
toHexString based on parameter matching.