Primitives

org.beangle.commons.lang.Primitives$
object Primitives

Wrap or Unwrap primitive

Attributes

Since:

3.2.0

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Concise view

Value members

Concrete methods

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

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

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

Attributes

See also:

Class#isPrimitive

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

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

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

   unwrap(Integer.class) == int.class
   unwrap(int.class) == int.class
   unwrap(String.class) == String.class

Attributes

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

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

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

   wrap(int.class) == Integer.class
   wrap(Integer.class) == Integer.class
   wrap(String.class) == String.class

Attributes