Package com.saperion.common.lang.unsafe
Class Unsafe
- java.lang.Object
-
- com.saperion.common.lang.unsafe.Unsafe
-
public final class Unsafe extends java.lang.Object
Utility class that provides some unsafe operations. Use these operations with care and only if really necessary!- Author:
- agz
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> T
cast(java.lang.Object object)
Unsafe cast that instructs the compiler to suppress compiler warnings.
-
-
-
Method Detail
-
cast
public static <T> T cast(java.lang.Object object)
Unsafe cast that instructs the compiler to suppress compiler warnings. ATTENTION: This increases the chance of runtime exceptions if used improperly. This method is intended for situations, where the compiler warning is wrong and there is no correct way to go around it. This often occurs when casting collections where unmanageable warnings relating the generic types appear.- Type Parameters:
T
- destination type- Parameters:
object
- object to cast- Returns:
- casted object
-
-