org.nakedobjects.applib.annotation
Annotation Type EqualByContent


@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).

See Also:
Immutable, Value

Optional Element Summary
 When value
           
 

value

public abstract When value
Default:
org.nakedobjects.applib.annotation.When.ALWAYS


Copyright © 2001-2009 Naked Objects Group Ltd.. All Rights Reserved.