@Documented @Retention(value=SOURCE) @Target(value=TYPE) public @interface ImmutableOptions
Immutable
,
ImmutablePropertyHandler
Modifier and Type | Optional Element and Description |
---|---|
Class[] |
knownImmutableClasses
Allows you to provide
@Immutable with a list of classes which
are deemed immutable. |
String[] |
knownImmutables
Allows you to provide
@Immutable with a list of property names which
are deemed immutable. |
public abstract Class[] knownImmutableClasses
@Immutable
with a list of classes which
are deemed immutable. By supplying a class in this list, you are vouching
for its immutability and @Immutable
will do no further checks.
Example:
import groovy.transform.*@Immutable
(knownImmutableClasses = [Address]) class Person { String first, last Address address }@TupleConstructor
class Address { final String street }
public abstract String[] knownImmutables
@Immutable
with a list of property names which
are deemed immutable. By supplying a property's name in this list, you are vouching
for its immutability and @Immutable
will do no further checks.
Example:
@groovy.transform.Immutable
(knownImmutables = ['address'])
class Person {
String first, last
Address address
}
...