Class FileReader

java.lang.Object
me.deecaad.core.file.FileReader

public class FileReader extends Object
  • Constructor Details

    • FileReader

      public FileReader(@NotNull @NotNull me.deecaad.core.MechanicsLogger debug, @Nullable @Nullable List<Serializer<?>> serializers, @Nullable @Nullable List<IValidator> validators)
  • Method Details

    • addSerializers

      public void addSerializers(List<Serializer<?>> serializers)
      Adds new serializers for this file reader. Serializers should be added before using fillAllFiles() or fillOneFile() methods.
      Parameters:
      serializers - the new list serializers for this file reader
    • addSerializer

      public void addSerializer(Serializer<?> serializer)
      Adds new serializer for this file reader. Serializers should be added before using fillAllFiles() or fillOneFile() methods.
      Parameters:
      serializer - the new serializer for this file reader
    • addValidators

      public void addValidators(List<IValidator> validators)
      Adds new validators for this file reader. Validators should be added before using fillAllFiles() or fillOneFile() methods.
      Parameters:
      validators - the new list validators for this file reader
    • addValidator

      public void addValidator(IValidator validator)
      Adds new validator for this file reader. Validators should be added before using fillAllFiles() or fillOneFile() methods.
      Parameters:
      validator - the new validator for this file reader
    • fillAllFiles

      public me.deecaad.core.file.Configuration fillAllFiles(File directory, @Nullable @Nullable String... ignoreFiles)
      Iterates through all .yml files inside every directory starting from the given directory. It is recommended to give this method plugin's data folder directory. This also takes in account given serializers.
      Parameters:
      directory - the directory
      ignoreFiles - ignored files which name starts with any given string
      Returns:
      the map with all configurations
    • fillOneFile

      @NotNull public @NotNull me.deecaad.core.file.Configuration fillOneFile(File file)
      Fills one file into map and returns its configuration. This also takes in account given serializers.
      Parameters:
      file - the file to read
      Returns:
      the map with file's configurations
    • usePathToSerializersAndValidators

      public me.deecaad.core.file.Configuration usePathToSerializersAndValidators(me.deecaad.core.file.Configuration filledMap)
      Uses all path to serializers and validators. This should be used AFTER normal serialization.
      Parameters:
      filledMap - the filled mappings
      Returns:
      the map with used path to serializers and validators