Class FileSourceCreator

java.lang.Object
mocka.generator.FileSourceCreator

@Component public class FileSourceCreator extends Object
  • Constructor Details

    • FileSourceCreator

      public FileSourceCreator()
  • Method Details

    • createFromFileSource

      public <T> T createFromFileSource(Class<T> clazz, FileSource fileSource)
      Creates an instance of the given class by analyzing the FileSource annotation.

      This method reads the data file specified in the FileSource annotation and maps its contents to a new instance of the specified entity class. It is primarily used to generate entities pre-populated with data from an external file source.

      Type Parameters:
      T - the type of entity to return
      Parameters:
      clazz - the class type of the entity to create
      fileSource - the FileSource annotation containing file path and metadata
      Returns:
      a new instance of clazz populated with data from the file