OperatorRename (Groovy 5.0.6)

Package: groovy.transform

## [Java] Annotation Type OperatorRename

- groovy.transform.OperatorRename

-     @Documented
      @Incubating
      @Retention(RetentionPolicy.SOURCE)
      @Target({ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.TYPE})
      @GroovyASTTransformationClass("org.codehaus.groovy.transform.OperatorRenameASTTransformation")
      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

- - ### Element Summary

    Optional Element Summary
    Type | Name and Description
    --- | ---
    `String` | `and` Default: Undefined.STRING
    `String` | `compareTo` Default: Undefined.STRING
    `String` | `div` Default: Undefined.STRING
    `String` | `leftShift` Default: Undefined.STRING
    `String` | `minus` Default: Undefined.STRING
    `String` | `multiply` Default: Undefined.STRING
    `String` | `or` Default: Undefined.STRING
    `String` | `plus` Default: Undefined.STRING
    `String` | `power` Default: Undefined.STRING
    `String` | `remainder` Default: Undefined.STRING
    `String` | `rightShift` Default: Undefined.STRING
    `String` | `rightShiftUnsigned` Default: Undefined.STRING
    `String` | `xor` Default: Undefined.STRING

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Element Detail

    - #### public String and

      Default:
        Undefined.STRING

    - #### public String compareTo

      Default:
        Undefined.STRING

    - #### public String div

      Default:
        Undefined.STRING

    - #### public String leftShift

      Default:
        Undefined.STRING

    - #### public String minus

      Default:
        Undefined.STRING

    - #### public String multiply

      Default:
        Undefined.STRING

    - #### public String or

      Default:
        Undefined.STRING

    - #### public String plus

      Default:
        Undefined.STRING

    - #### public String power

      Default:
        Undefined.STRING

    - #### public String remainder

      Default:
        Undefined.STRING

    - #### public String rightShift

      Default:
        Undefined.STRING

    - #### public String rightShiftUnsigned

      Default:
        Undefined.STRING

    - #### public String xor

      Default:
        Undefined.STRING