Interface OsidPrimitive
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
Coordinate, Coordinate, Currency, Currency, DateTime, DateTime, DisplayText, DisplayText, Distance, Distance, Duration, Duration, Heading, Heading, Id, Id, OsidPrimitive, SpatialUnit, SpatialUnit, Speed, Speed, Time, Time, Type, Type, Version, Version
Some OSID interfaces are designated as "primitives" in that
they may be constructed by either the OSID Consumer or OSID
Provider. They do not encapsulate provider-specific details but
are used as a shuttle of information both ways across the
OSIDs.
The design of an OsidPrimitive implementation should take care not
to include logic, such as introducing Type compatibility, where
comparison methods exhibit different behavior. All comparison
methods such as
equals() should be commutative such
that object1.equals(object2) has the same result as
object2.equals(object1).
Primitives support Java Serialization. Java serialization and
deserialization is used for persisting and retrieving the state of
the internal object. toString() can be used for
outputting a standard format, as for example a date or a Type,
using the exposed interfaces that can be used for reconstructing
the underlying object from scratch. In this case, offering a
valueOf() method to that is compatible with the
object's output format can be handy.
Output display and serialization will vary depending on the
implementation of this interface. Consumers needing a consistent
behavior across all OSID Providers should wrap this primitive in
another of known behavior. Implementations of OsidPrimitives are
also encouraged to permit easy construction given another object
of the same interface.-
Method Summary
-
Method Details
-
toString
String toString()Returns a string representation of this OsidPrimitive. All implementations are encouraged to supply this method to provide a readable display. Some objects may pretty print the primitive while others may serialize for convenient persistence.
-