net.sf.mmm.util.lang.api
Interface Datatype<V>

Type Parameters:
V - is the generic type of the value.
All Known Implementing Classes:
Comparator, Conjunction, DiacriticalMark, HorizontalAlignment

public interface Datatype<V>

This is the interface for a datatype. A datatype is an immutable object representing a simple value of a specific type.
Common generic datatypes are String, Boolean, Long, Integer, Double and Date. They should be accepted as datatypes even though they do NOT implement this interface.
An implementation of this interface should declare all its member variables as final and bind them at construction. An Enum implementing this interface should also offer a static method called fromValue(V value) that returns the appropriate Enum instance or null if no such instance exists.

Since:
2.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Method Summary
 String getTitle()
          This method gets the title of this datatype.
 V getValue()
          This method returns the raw value of this datatype.
 String toString()
          This method needs to return the same result a getTitle().
 

Method Detail

getValue

V getValue()
This method returns the raw value of this datatype. This will typically be a common java.lang datatype. In case of a composed datatype it is also legal that this method returns the datatype instance itself.

Returns:
the value of this datatype.

getTitle

String getTitle()
This method gets the title of this datatype. The title is a string representation intended to be displayed to end-users (i18n will be done externally - see NlsMessage).
Since the general contract of toString() is quite weak, this method is added to explicitly express the presence of the title and to ensure implementors of this interface can NOT miss to implement this.

Returns:
the display title of this datatype.
See Also:
toString()

toString

String toString()
This method needs to return the same result a getTitle().

Overrides:
toString in class Object
Returns:
the display title of this datatype.


Copyright © 2001-2010 mmm-Team. All Rights Reserved.