org.jtoolkit.essence.concurrency
Annotation Type Immutable
@Target(value={TYPE,PARAMETER,METHOD,FIELD})
@Retention(value=RUNTIME)
@Inherited
public @interface Immutable
Marks a class as immutable and thus thread safe, a parameter as unchanged and a method which does not change this.
If a class is @Immutable all its methods are assumed to be immutable.
If a parameter is Immutable the method will not alter it.
If a method is immutable, it does not alter the class.
Note: an object can be marked as @Immutable(false). This means the object will be treated as immutable however some fields may be mutable.
This is useful to maintaining statictics and is only clustered or persisted on a best effort basis.
No guarentees can made about mutable fields in an Immutable object.
Immutable object and components can be accessed by mutliple threads or externally to the Container.
- Author:
- Peter Lawrey
|
Optional Element Summary |
boolean |
value
|
value
public abstract boolean value
- Default:
- true
Copyright © Peter Lawrey. All Rights Reserved.