org.nakedobjects.applib.adapters
Interface ValueSemanticsProvider<T>

All Known Implementing Classes:
AbstractValueSemanticsProvider

public interface ValueSemanticsProvider<T>

Provides a mechanism for providing a set of value semantics.

As explained in the Javadoc of the Value annotation, value semantics only actually implies that the type is aggregated. However, values are very often also Parseable, Encodable, Immutable and implement EqualByContent semantics. In addition, there may be a default value.

This interface is used by Value to allow these semantics to be provided through a single point. Alternatively, Value supports this information being provided via the configuration files.

Whatever the class that implements this interface, it must also expose either a public no-arg constructor, or (for implementations that also are Facets) a public constructor that accepts a single FacetHolder. This constructor allows the framework to instantiate the object reflectively.

See Also:
Parser, EncoderDecoder, DefaultsProvider

Method Summary
 DefaultsProvider<T> getDefaultsProvider()
          The DefaultsProvider, if any.
 EncoderDecoder<T> getEncoderDecoder()
          The EncoderDecoder, if any.
 Parser<T> getParser()
          The Parser, if any.
 boolean isEqualByContent()
          Whether the value has equal by content semantics.
 boolean isImmutable()
          Whether the value is Immutable.
 

Method Detail

getParser

Parser<T> getParser()
The Parser, if any.

If not null, implies that the value is Parseable.


getEncoderDecoder

EncoderDecoder<T> getEncoderDecoder()
The EncoderDecoder, if any.

If not null, implies that the value is Encodable.


getDefaultsProvider

DefaultsProvider<T> getDefaultsProvider()
The DefaultsProvider, if any.

If not null, implies that the value has (or may have) a default.


isImmutable

boolean isImmutable()
Whether the value is Immutable.


isEqualByContent

boolean isEqualByContent()
Whether the value has equal by content semantics.

If so, then it must implement equals(Object) and hashCode() consistently. Examples in the Java language that do this are String and BigDecimal, for example.



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