|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Retention(value=RUNTIME) @Target(value=METHOD) public @interface ReturnsUnchangedParameter
The annotated method returns a parameter without changing it. The annotations' value contains the index of the parameter returned; it defaults to 0, i.e. the first parameter.
More precisely, this annotation states that the method's return value is logically and transitively identical to the value passed. Logically identical means that the returned object has the same logical identity, transitive means that this must hold for all references reachable through it as well. Note that objects without logical identity are trivially logically identical, ending the recursion. Logical identity is defined by the subclass of AbstractIdentityFixer in use.
For instance,
@ReturnsUnchangedParameter T saveOrUpdate(T entity);means that saving an object returns the saved object, which is logically identical to its former version.
As of JDK 1.5, it is impossible to inherit method annotations when overriding/implementing a method; such annotations must therefore be provided manually.
AbstractIdentityFixer
Optional Element Summary | |
---|---|
int |
value
The index of the parameter returned. |
public abstract int value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |