Class UnsafeInternals

java.lang.Object
ru.progrm_jarvis.javacommons.unsafe.UnsafeInternals

public final class UnsafeInternals extends Object
Commonly used unsafe Java internals.
  • Field Details

    • UNSAFE_CLASS

      @Nullable public static final @Nullable Class<?> UNSAFE_CLASS
      Unsafe class object
    • MAGIC_ACCESSOR_IMPL_CLASS

      @Nullable public static final @Nullable Class<?> MAGIC_ACCESSOR_IMPL_CLASS
      MagicAccessorImpl class object
    • UNSAFE_CLASS_NAME

      @Nullable public static final @Nullable String UNSAFE_CLASS_NAME
      Name of UNSAFE_CLASS class
    • MAGIC_ACCESSOR_IMPL_CLASS_NAME

      @Nullable public static final @Nullable String MAGIC_ACCESSOR_IMPL_CLASS_NAME
  • Method Details

    • staticFieldValue

      @NotNull public static @NotNull Result<Object,@Nullable Void> staticFieldValue(@NonNull @NonNull Field field)
      Gets the value of the static field using Unsafe if it is possible.
      Parameters:
      field - field whose value should be read
      Returns:
      result containing the value of the static field or an empty result if this unsafe feature is unavailable