|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||
@Inherited
@Target(value={TYPE,METHOD})
@Retention(value=RUNTIME)
public @interface EqualByContent
Indicates that the class follows the equal-by-content contract, usually associated with value
types.
If a class claims to be equal-by-content then its Annotation.equals(Object) should return true if
its content (as opposed to identity) is the same. For example, String, BigDecimal and
Date follow this contract.
Note also that the Java Language Specification requires that two objects that are
equal must return the same value from Annotation.hashCode(). Failure to do this
means that that the object will not behave correctly when used as a key into a hashing structure (eg a
HashMap).
By default any value types are assumed to follow the equal-by-content rule, though this can
be overridden if required. Value types are usually also immutable (though there are some
classic exceptions to this, such as Date).
Immutable,
Value| Optional Element Summary | |
|---|---|
When |
value
|
public abstract When value
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||