![JAR search and dependency download from the Maven repository](/logo.png)
org.nakedobjects.applib.annotation.Immutable Maven / Gradle / Ivy
package org.nakedobjects.applib.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Indicates that an instance cannot be changed.
*
*
* To make something always immutable used the form @Immutable. To make something immutable only once persisted use the form
* @Immutable(Immutable.ONCE_PERSISTED).
*
*
* By default any {@link Value value} types are assumed to be immutable, though this can be overridden if
* required. Immutable objects that are acting as a value type should almost certainly also follow the
* {@link EqualByContent equal-by-content} contract.
*
* @see Value
* @see EqualByContent
*/
@Inherited
@Target( { ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface Immutable {
When value() default When.ALWAYS;
}
// Copyright (c) Naked Objects Group Ltd.
© 2015 - 2025 Weber Informatics LLC | Privacy Policy