Package groovy.transform

# Annotation Type OperatorRename

@Documented @Incubating @Retention(SOURCE) @Target({METHOD,CONSTRUCTOR,TYPE}) public @interface OperatorRename
Allows renaming of Groovy's operator methods. This can be useful for using Groovy's operator overloading with libraries designed with different method names. As an example, here is using the Commons Numbers Fraction library. This normally has an "add" method, but we can use the "+" operator using this transform.

     @OperatorRename(plus="add")
     def testAddOfTwoFractions() {
         var half = Fraction.of(1, 2)
         var third = Fraction.of(1, 3)
         assert half + third == Fraction.of(5, 6)
     }

Since:
  5.0.0

- ## Optional Element Summary

  Optional Elements
  Modifier and Type
  Optional Element
  Description
  `String`
  `and`
  `String`
  `compareTo`
  `String`
  `div`
  `String`
  `leftShift`
  `String`
  `minus`
  `String`
  `multiply`
  `String`
  `or`
  `String`
  `plus`
  `String`
  `power`
  `String`
  `remainder`
  `String`
  `rightShift`
  `String`
  `rightShiftUnsigned`
  `String`
  `xor`

- ## Element Details

  - ### plus

    String plus
    Default:
      "<DummyUndefinedMarkerString-DoNotUse>"

  - ### minus

    String minus
    Default:
      "<DummyUndefinedMarkerString-DoNotUse>"

  - ### multiply

    String multiply
    Default:
      "<DummyUndefinedMarkerString-DoNotUse>"

  - ### div

    String div
    Default:
      "<DummyUndefinedMarkerString-DoNotUse>"

  - ### remainder

    String remainder
    Default:
      "<DummyUndefinedMarkerString-DoNotUse>"

  - ### power

    String power
    Default:
      "<DummyUndefinedMarkerString-DoNotUse>"

  - ### leftShift

    String leftShift
    Default:
      "<DummyUndefinedMarkerString-DoNotUse>"

  - ### rightShift

    String rightShift
    Default:
      "<DummyUndefinedMarkerString-DoNotUse>"

  - ### rightShiftUnsigned

    String rightShiftUnsigned
    Default:
      "<DummyUndefinedMarkerString-DoNotUse>"

  - ### and

    String and
    Default:
      "<DummyUndefinedMarkerString-DoNotUse>"

  - ### or

    String or
    Default:
      "<DummyUndefinedMarkerString-DoNotUse>"

  - ### xor

    String xor
    Default:
      "<DummyUndefinedMarkerString-DoNotUse>"

  - ### compareTo

    String compareTo
    Default:
      "<DummyUndefinedMarkerString-DoNotUse>"