Interface InstanceAllocatorFactory

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface InstanceAllocatorFactory
Instance allocator factory interface.
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    Tells whether allocators of this factory call a constructor of the type.
    Prepares an allocator for the type.
  • Method Details

    • newAllocator

      <T> Optional<InstanceAllocator<T>> newAllocator(Class<T> type)
      Prepares an allocator for the type. Whether the factory supports the type is decided here, so the allocator fails only because of the environment or the object itself.
      Type Parameters:
      T - object type
      Parameters:
      type - type
      Returns:
      allocator, or empty if the factory cannot create instances of the type
    • invokesConstructor

      default boolean invokesConstructor()
      Tells whether allocators of this factory call a constructor of the type. Constructors may have side effects which a clone should not repeat.
      Returns:
      true if allocators call constructors, false if they only allocate objects