AutoExternalize (Groovy 5.0.6)

Package: groovy.transform

## [Groovy] Annotation Type AutoExternalize

- groovy.transform.AutoExternalize

- All Implemented Interfaces and Traits:
    Annotation

      @AnnotationCollector(value: [ExternalizeMethods, ExternalizeVerifier])
      @Retention(value: RetentionPolicy.SOURCE)
      @Target(value: ElementType.TYPE)
      @interface AutoExternalize

  Annotation used to assist in the creation of `Externalizable` classes. The `@AutoExternalize` annotation instructs the compiler to execute an AST transformation which adds `writeExternal()` and `readExternal()` methods to a class and adds `Externalizable` to the interfaces which the class implements. The `writeExternal()` method writes each property (or field) for the class while the `readExternal()` method will read each one back in the same order. Properties or fields marked as `transient` are ignored.

  Example usage:

       import groovy.transform.*
       @AutoExternalize
       class Person {
         String first, last
         List favItems
         Date since
       }

  Which will create a class of the following form:

       class Person implements Externalizable {
         ...
         public void writeExternal(ObjectOutput out) throws IOException {
           out.writeObject(first)
           out.writeObject(last)
           out.writeObject(favItems)
           out.writeObject(since)
         }

         public void readExternal(ObjectInput oin) {
           first = oin.readObject()
           last = oin.readObject()
           favItems = oin.readObject()
           since = oin.readObject()
         }
         ...
       }

  The `@AutoExternalize` transform is implemented as a combination of the `@ExternalizeMethods` and `@ExternalizeVerifier` transforms.

  Since:
    1.8.0

- - ### Inherited Methods Summary

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