Interface Initiator


public interface Initiator
A utility interface: can extend producer classes with the functionality to create instances of types composed (essentially) of properties and constructed like a record (as defined with Java 17). This means that the type in question must provide a public constructor that takes all properties as parameters. It may or may not actually be a record.

If there are multiple constructors, it is assumed that the public constructor with the largest number of parameters should be used.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    default <T> T
    initiate(Class<T> targetType, String... ignore)
    Creates and returns a new instance of a given target type.
  • Method Details

    • initiate

      default <T> T initiate(Class<T> targetType, String... ignore)
      Creates and returns a new instance of a given target type. The target type is assumed to have a constructor that must be parameterized with property values. If the type has multiple constructors, it is assumed that the constructor with the largest number of parameters should be used.
      Type Parameters:
      T - The target type.
      Parameters:
      targetType - The Class representation of the target type.
      ignore - The names of methods or constructor arguments that shell be ignored.