Class PropertyAccessorFactoryUnsafe


public final class PropertyAccessorFactoryUnsafe extends PropertyAccessorFactoryLambda
A specialized property accessor factory that uses Unsafe operations for field access to provide better performance compared to reflection-based access. This factory creates property accessors that use direct memory access via Unsafe to get and set field values, which is faster than traditional reflection.

Note: This factory is named "Unsafe" because it uses sun.misc.Unsafe, which is not part of the standard Java API and may not be available in all JVM implementations.

This class extends PropertyAccessorFactory and overrides specific methods to provide Unsafe-based implementations for field access while maintaining compatibility with the parent class's method-based and function-based access patterns.

  • Constructor Details

    • PropertyAccessorFactoryUnsafe

      public PropertyAccessorFactoryUnsafe()
  • Method Details

    • createInternal

      protected PropertyAccessor createInternal(Field field)
      Creates an Unsafe-based property accessor for the specified field. This method analyzes the field type and returns an appropriate accessor implementation optimized for that type using Unsafe operations.
      Overrides:
      createInternal in class PropertyAccessorFactory
      Parameters:
      field - the field to create an accessor for
      Returns:
      a PropertyAccessor instance for the specified field using Unsafe operations