Skip to content

Instantly share code, notes, and snippets.

@melix
Created July 29, 2013 14:07
Show Gist options
  • Save melix/6104533 to your computer and use it in GitHub Desktop.
Save melix/6104533 to your computer and use it in GitHub Desktop.
Immutable+Newify+CompileStatic
import groovy.transform.*
@Immutable class Coordinates {
double latitude, longitude
}
@Immutable class Path {
Coordinates[] coordinates
}
@Newify([Coordinates, Path])
@CompileStatic
def build() {
Path(
Coordinates(48.824068d, 2.531733d),
Coordinates(48.857840d, 2.347212d),
Coordinates(48.858429d, 2.342622d)
)
}
assert build().coordinates.size() == 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment