Class RPCInternalInstanceFactory.TempRPCInternalInstanceFactory

java.lang.Object
eu.cloudnetservice.driver.impl.network.rpc.generation.RPCInternalInstanceFactory
eu.cloudnetservice.driver.impl.network.rpc.generation.RPCInternalInstanceFactory.TempRPCInternalInstanceFactory
Enclosing class:
RPCInternalInstanceFactory

static final class RPCInternalInstanceFactory.TempRPCInternalInstanceFactory extends RPCInternalInstanceFactory
An instance factory implementation that is temporarily not delegated (during class construction) to prevent issues with circular class references.
Since:
4.0
  • Field Details

  • Constructor Details

    • TempRPCInternalInstanceFactory

      TempRPCInternalInstanceFactory()
  • Method Details

    • setDelegate

      public void setDelegate(@NonNull @NonNull RPCInternalInstanceFactory delegate)
      Sets the delegate instance factory if that didn't happen yet.
      Parameters:
      delegate - the delegate instance factory to set.
      Throws:
      NullPointerException - if the given delegate is null.
    • constructInstance

      @NonNull public @NonNull Object constructInstance(@Nullable @Nullable eu.cloudnetservice.driver.network.rpc.ChainableRPC baseRPC, @NonNull @NonNull Supplier<eu.cloudnetservice.driver.network.NetworkChannel> channelSupplier, @NonNull @NonNull Object[] additionalConstructorArgs)
      Uses the delegate instance of this temp factory to construct the target rpc implementation class.
      Overrides:
      constructInstance in class RPCInternalInstanceFactory
      Parameters:
      baseRPC - the base RPC to use for chained api calls.
      channelSupplier - the channel supplier to which all network requests should be sent.
      additionalConstructorArgs - the array of additional constructor args to supply to the generated class.
      Returns:
      a constructed instance of the generated rpc class implementation.
      Throws:
      NullPointerException - if the given channel supplier or additional args is null.
      IllegalArgumentException - if the given additional constructor args mismatch the expected count.
      IllegalStateException - if this factory is not yet delegated or the construction fails.
    • constructInstance

      @NonNull public @NonNull Object constructInstance(@Nullable @Nullable eu.cloudnetservice.driver.network.rpc.ChainableRPC baseRPC, @Nullable @Nullable eu.cloudnetservice.driver.network.rpc.RPCSender classRPCSender, @NonNull @NonNull Supplier<eu.cloudnetservice.driver.network.NetworkChannel> channelSupplier, @NonNull @NonNull Object[] additionalConstructorArgs)
      Uses the delegate instance of this temp factory to construct the target rpc implementation class.
      Overrides:
      constructInstance in class RPCInternalInstanceFactory
      Parameters:
      baseRPC - the base RPC to use for chained api calls.
      classRPCSender - the rpc sender to use instead of the fallback one given to this factory.
      channelSupplier - the channel supplier to which all network requests should be sent.
      additionalConstructorArgs - the array of additional constructor args to supply to the generated class.
      Returns:
      a constructed instance of the generated rpc class implementation.
      Throws:
      NullPointerException - if the given channel supplier or additional args is null.
      IllegalArgumentException - if the given additional constructor args mismatch the expected count.
      IllegalStateException - if this factory is not yet delegated or the construction fails.