# TypeRef (dapr-sdk-parent 1.10.0 API)

Package io.dapr.utils

## Class TypeRef<T>

- java.lang.Object
- - io.dapr.utils.TypeRef<T>

Type Parameters:
  `T` - Type to be deserialized.

    public abstract class TypeRef<T>
    extends Object

Used to reference a type.

Usage: new TypeRef<MyClass>(){}

### Field Summary

Fields
`static TypeRef<Boolean>` `BOOLEAN`
`static TypeRef<Byte>` `BYTE`
`static TypeRef<byte[]>` `BYTE_ARRAY`
`static TypeRef<Character>` `CHAR`
`static TypeRef<Double>` `DOUBLE`
`static TypeRef<Float>` `FLOAT`
`static TypeRef<Integer>` `INT`
`static TypeRef<int[]>` `INT_ARRAY`
`static TypeRef<Long>` `LONG`
`static TypeRef<Short>` `SHORT`
`static TypeRef<String>` `STRING`
`static TypeRef<String[]>` `STRING_ARRAY`
`static TypeRef<Void>` `VOID`

### Constructor Summary

Constructors
`TypeRef()` Constructor.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static <T> TypeRef<T>` `get​(Class<T> clazz)` Creates a reference to a given class type.
`static <T> TypeRef<T>` `get​(Type type)` Creates a reference to a given class type.
`Type` `getType()` Gets the type referenced.
`static <T> boolean` `isPrimitive​(TypeRef<T> typeRef)` Checks if the given TypeRef is of a primitive type Similar to implementation of deserializePrimitives in the class `ObjectSerializer` It considers only those types as primitives.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### STRING

    public static final TypeRef<String> STRING

#### BOOLEAN

    public static final TypeRef<Boolean> BOOLEAN

#### INT

    public static final TypeRef<Integer> INT

#### LONG

    public static final TypeRef<Long> LONG

#### SHORT

    public static final TypeRef<Short> SHORT

#### CHAR

    public static final TypeRef<Character> CHAR

#### BYTE

    public static final TypeRef<Byte> BYTE

#### VOID

    public static final TypeRef<Void> VOID

#### FLOAT

    public static final TypeRef<Float> FLOAT

#### DOUBLE

    public static final TypeRef<Double> DOUBLE

#### BYTE_ARRAY

    public static final TypeRef<byte[]> BYTE_ARRAY

#### INT_ARRAY

    public static final TypeRef<int[]> INT_ARRAY

#### STRING_ARRAY

    public static final TypeRef<String[]> STRING_ARRAY

### Constructor Detail

#### TypeRef

    public TypeRef()

Constructor.

### Method Detail

#### getType

    public Type getType()

Gets the type referenced.

Returns:
  type referenced.

#### get

    public static <T> TypeRef<T> get​(Class<T> clazz)

Creates a reference to a given class type.

Type Parameters:
  `T` - Type to be referenced.
Parameters:
  `clazz` - Class type to be referenced.
Returns:
  Class type reference.

#### get

    public static <T> TypeRef<T> get​(Type type)

Creates a reference to a given class type.

Type Parameters:
  `T` - Type to be referenced.
Parameters:
  `type` - Type to be referenced.
Returns:
  Class type reference.

#### isPrimitive

    public static <T> boolean isPrimitive​(TypeRef<T> typeRef)

Checks if the given TypeRef is of a primitive type Similar to implementation of deserializePrimitives in the class `ObjectSerializer` It considers only those types as primitives.

Type Parameters:
  `T` - Type to be referenced.
Parameters:
  `typeRef` - Type to be referenced.
Returns:
  truth value of whether the given type ref is a primitive reference or not.