Interface ChooseAlgorithm


public interface ChooseAlgorithm
Interface designed to aid in the selection and implementation of different encryption algorithms.

This interface is part of a library that facilitates algorithm switching. It provides default implementations to help select an appropriate encryption algorithm based on the specified criteria, but its use is optional. Algorithm switching can still be performed without implementing this interface, though using it simplifies the process.

The chooseAlgorithmImplementation method uses a switch statement to determine which implementation of the encryption algorithm should be used based on the value returned by the getSELECTED_ALGORITHM_FOR_PRODUCTION() method of the provided EncryptionAlgorithm instance.

Implementing classes must provide concrete implementations for the three methods: implementAlgorithm1, implementAlgorithm2, and implementAlgorithm3.

  • Method Details

    • chooseAlgorithmImplementation

      default void chooseAlgorithmImplementation(EncryptionAlgorithm encryptionAlgorithm)
      Chooses the appropriate algorithm implementation based on the provided encryption algorithm.
      Parameters:
      encryptionAlgorithm - The encryption algorithm whose selected algorithm will determine which method to invoke.
    • implementAlgorithm1

      void implementAlgorithm1()
      Implement the first encryption algorithm.
    • implementAlgorithm2

      void implementAlgorithm2()
      Implement the second encryption algorithm.
    • implementAlgorithm3

      void implementAlgorithm3()
      Implement the third encryption algorithm.