Primitives

object Primitives

Wrap or Unwrap primitive

Since

3.2.0

class Object
trait Matchable
class Any

Value members

Concrete methods

def default[T](clazz: Class[T]): T
def defaultLiteral[T](clazz: Class[T]): String
def isWrapperType(clazz: Class[_]): Boolean

Returns <code>true</code> if <code>type</code> is one of the nine primitive-wrapper types, such as [[Integer]].

Returns <code>true</code> if <code>type</code> is one of the nine primitive-wrapper types, such as [[Integer]].

See also

Class#isPrimitive

def unwrap[T](clazz: Class[T]): Class[T]

Returns the corresponding primitive type of <code>type</code> if it is a wrapper type; otherwise returns <code>type</code> itself. Idempotent.

Returns the corresponding primitive type of <code>type</code> if it is a wrapper type; otherwise returns <code>type</code> itself. Idempotent.

<pre> unwrap(Integer.class) == int.class unwrap(int.class) == int.class unwrap(String.class) == String.class </pre>

def wrap[T](clazz: Class[T]): Class[T]

Returns the corresponding wrapper type of <code>type</code> if it is a primitive type; otherwise returns <code>type</code> itself. Idempotent.

Returns the corresponding wrapper type of <code>type</code> if it is a primitive type; otherwise returns <code>type</code> itself. Idempotent.

<pre> wrap(int.class) == Integer.class wrap(Integer.class) == Integer.class wrap(String.class) == String.class </pre>