Allow to convert Java value to literal of certain type.

Change-Id: Ic023c29fbf679432be94d1b141b84f0728838476