Class UnsafeInternals
java.lang.Object
ru.progrm_jarvis.javacommons.unsafe.UnsafeInternals
Commonly used unsafe Java internals.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final @Nullable Class<?>MagicAccessorImplclass objectstatic final @Nullable StringName ofMAGIC_ACCESSOR_IMPL_CLASSclassstatic final @Nullable Class<?>Unsafeclass objectstatic final @Nullable StringName ofUNSAFE_CLASSclass -
Method Summary
Modifier and TypeMethodDescriptionstaticFieldValue(@NonNull Field field) Gets the value of the static field usingUnsafeif it is possible.
-
Field Details
-
UNSAFE_CLASS
Unsafeclass object -
MAGIC_ACCESSOR_IMPL_CLASS
MagicAccessorImplclass object -
UNSAFE_CLASS_NAME
Name ofUNSAFE_CLASSclass -
MAGIC_ACCESSOR_IMPL_CLASS_NAME
Name ofMAGIC_ACCESSOR_IMPL_CLASSclass
-
-
Method Details
-
staticFieldValue
@NotNull public static @NotNull Result<Object,@Nullable Void> staticFieldValue(@NonNull @NonNull Field field) Gets the value of the static field usingUnsafeif 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
-