Package groovy.transform
Annotation Type AutoExternalize
-
@Documented @Retention(RUNTIME) @Target(TYPE) public @interface AutoExternalizeNote: This annotation is currently experimental! Use at your own risk! Class annotation used to assist in the creation ofExternalizableclasses. The@AutoExternalizeannotation instructs the compiler to execute an AST transformation which addswriteExternal()andreadExternal()methods to a class and addsExternalizableto the interfaces which the class implements. ThewriteExternal()method writes each property (or field) for the class while thereadExternal()method will read each one back in the same order. Properties or fields marked astransientare ignored. Example usage:import groovy.transform.*
Which will create a class of the following form:@AutoExternalizeclass Person { String first, last List favItems Date since }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() } ... }- Since:
- 1.8.0
- Author:
- Paul King
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description java.lang.StringexcludesComma separated list of property names to exclude from externalizingbooleanincludeFieldsInclude fields as well as properties when externalizing
-