#include <coherence/lang/Primitive.hpp>
Inherits Object, and Comparable.
Public Types | |||||||
typedef spec::Handle | Handle | ||||||
Primitive<T> Handle definition. | |||||||
typedef spec::View | View | ||||||
Primitive<T> View definition. | |||||||
typedef spec::Holder | Holder | ||||||
Primitive<T> Holder definition. | |||||||
typedef T | BoxedType | ||||||
The boxed primitive type. | |||||||
Public Member Functions | |||||||
virtual T | getValue () const | ||||||
Return the primitive value. | |||||||
operator T () const | |||||||
Return the primitive value. | |||||||
virtual int32_t | compareTo (Object::View v) const | ||||||
Compare this object with the specified object for order. Return a negative integer, zero, or a positive integer if this object is less than, equal to, or greater than the specified object.
It is strongly recommended, but not strictly required, that
| |||||||
virtual bool | equals (Object::View v) const | ||||||
Return true iff the specified Object is "equal" to this Object. This method implements an equivalence relation on Objects:
The default implementation is a reference equality comparison.
| |||||||
virtual size32_t | hashCode () const | ||||||
Return a hash code value for the Object. This method is supported for the benefit of hash-based containers.
The general contract of
The default implementation is identity based.
| |||||||
virtual bool | isImmutable () const | ||||||
| |||||||
virtual void | toStream (std::ostream &out) const | ||||||
| |||||||
Static Public Member Functions | |||||||
static T | parse (String::View vs, size_t nPrecision=0) | ||||||
Return the primitive representation of a String. | |||||||
Protected Member Functions | |||||||
Primitive (const Primitive< T > &that) | |||||||
Copy constructor. | |||||||
Protected Attributes | |||||||
T | m_value | ||||||
The wrapped primitive value. |
virtual T getValue | ( | ) | const [virtual] |
Return the primitive value.
operator T | ( | ) | const |
Return the primitive value.
static T parse | ( | String::View | vs, | |
size_t | nPrecision = 0 | |||
) | [static] |
Return the primitive representation of a String.
vs | the String to covert to a primitive type | |
nPrecision | the (optional) precision, if applicable, of the primitive type |
IllegalArgumentException | if the supplied String is not convertible to the primitive type. NULL is considered an illegal argument except for the bool type, where it results in a bool(false). |