Ignore_GroovyExtensions.groovy 607 B

123456789101112131415161718192021
  1. /**
  2. * 扩展一些Groovy方法
  3. */
  4. class Ignore_GroovyExtensions {
  5. static void apply() {
  6. List.metaClass {
  7. findQuotedElement = { Map<String, String> conditions ->
  8. delegate.find { element ->
  9. conditions.every { condition, value -> element[condition] == value }
  10. }
  11. }
  12. findQuotedElements = { Map<String, String> conditions ->
  13. delegate.findAll { element ->
  14. conditions.every { condition, value -> element[condition] == value }
  15. }
  16. }
  17. }
  18. }
  19. }