Package me.deecaad.core.file
Class FileReader
java.lang.Object
me.deecaad.core.file.FileReader
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordStores temporary data to help with the 'Path To' feature of serializers, specifically when used nested inSerializeData.static final recordStores temporary data to help with the 'Path To' feature of serializers.static final recordStores temporary data to help with 'Validators', a type of serializer checked AFTER all serialization is done. -
Constructor Summary
ConstructorsConstructorDescriptionFileReader(@NotNull me.deecaad.core.MechanicsLogger debug, @Nullable List<Serializer<?>> serializers, @Nullable List<IValidator> validators) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSerializer(Serializer<?> serializer) Adds new serializer for this file reader.voidaddSerializers(List<Serializer<?>> serializers) Adds new serializers for this file reader.voidaddValidator(IValidator validator) Adds new validator for this file reader.voidaddValidators(List<IValidator> validators) Adds new validators for this file reader.me.deecaad.core.file.ConfigurationfillAllFiles(File directory, @Nullable String... ignoreFiles) Iterates through all .yml files inside every directory starting from the given directory.@NotNull me.deecaad.core.file.ConfigurationfillOneFile(File file) Fills one file into map and returns its configuration.me.deecaad.core.file.ConfigurationusePathToSerializersAndValidators(me.deecaad.core.file.Configuration filledMap) Uses all path to serializers and validators.
-
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
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
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
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
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 directoryignoreFiles- ignored files which name starts with any given string- Returns:
- the map with all configurations
-
fillOneFile
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
-