Class Unsafe

java.lang.Object
com.saperion.common.lang.unsafe.Unsafe

public final class Unsafe extends Object
Utility class that provides some unsafe operations. Use these operations with care and only if really necessary!
Author:
agz
  • Method Details

    • cast

      public static <T> T cast(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