From 9ede5f64b894f92272d387c08db0b82929def5ca Mon Sep 17 00:00:00 2001 From: warburec <77669019+warburec@users.noreply.github.com> Date: Wed, 30 Sep 2026 00:54:21 +0100 Subject: [PATCH 1/6] Added Storage README and usage diagram --- docs/diagrams/StorageUsagePipeline.drawio.svg | 362 ++++++++++++++++++ src/main/java/storage/README.md | 14 + 2 files changed, 376 insertions(+) create mode 100644 docs/diagrams/StorageUsagePipeline.drawio.svg create mode 100644 src/main/java/storage/README.md diff --git a/docs/diagrams/StorageUsagePipeline.drawio.svg b/docs/diagrams/StorageUsagePipeline.drawio.svg new file mode 100644 index 0000000..d00917a --- /dev/null +++ b/docs/diagrams/StorageUsagePipeline.drawio.svg @@ -0,0 +1,362 @@ + + + + + + + + + + + + + + + + +
+
+
+ StorageValue representation +
+
+
+
+ + StorageValue representation + +
+
+
+
+
+ + + + + + + + +
+
+
+ Storable component +
+
+
+
+ + Storable component + +
+
+
+
+ + + + + + + + + + +
+
+
+ Chosen output format +
+
+
+
+ + Chosen output format + +
+
+
+
+
+ + + + + + + + +
+
+
+ ValueFormatter +
+
+
+
+ + ValueFormatter + +
+
+
+
+ + + + + + + + +
+
+
+ StreamWriter +
+
+
+
+ + StreamWriter + +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+ Stream or File +
+
+
+
+ + Stream or File + +
+
+
+
+ + + + + + + + + + +
+
+
+ Streamed output +
+
+
+
+ + Streamed output + +
+
+
+
+
+ + + + + + + + + + +
+
+
+ StorageValue representation +
+
+
+
+ + StorageValue representation + +
+
+
+
+
+ + + + + + + + +
+
+
+ Loadable component +
+
+
+
+ + Loadable component + +
+
+
+
+ + + + + + + + +
+
+
+ ValueFormatter +
+
+
+
+ + ValueFormatter + +
+
+
+
+ + + + + + + + + + +
+
+
+ Expected input format +
+
+
+
+ + Expected input format + +
+
+
+
+
+ + + + + + + + +
+
+
+ StreamReader +
+
+
+
+ + StreamReader + +
+
+
+
+ + + + + +
+
+
+ Streamed input +
+
+
+
+ + Streamed input + +
+
+
+
+ + + + + + + + + +
+
+
+ Storage Helper +
+
+
+
+ + Storage Helper + +
+
+
+
+
+
+
+ + + + + Text is not SVG - cannot display + + + +
\ No newline at end of file diff --git a/src/main/java/storage/README.md b/src/main/java/storage/README.md new file mode 100644 index 0000000..89b5620 --- /dev/null +++ b/src/main/java/storage/README.md @@ -0,0 +1,14 @@ +# Dynamic Storage +A system for storing of objects dynamically within Java. + +## How it works +Objects can produce a `StroageValue` representation of their state. This state can be passed to the `Storage` helper to be stored to a stream or file (and formatted as required). + +Stored state may be loaded through the `Storable` helper, and may be used to hydrate objects through the `Loadable` interface. + +## Diagrams +### Usage Pipeline +![Usage Pipeline Diagram](/docs/diagrams/StorageUsagePipeline.drawio.svg) + +### Architecture +![Architecture Diagram](/docs/diagrams/Storage.drawio.svg) \ No newline at end of file From bfb89a140337a1f4dc9e844a1c4fed0c78b2a92e Mon Sep 17 00:00:00 2001 From: warburec <77669019+warburec@users.noreply.github.com> Date: Fri, 2 Oct 2026 18:53:01 +0100 Subject: [PATCH 2/6] Storage architecture fix and diagram --- docs/diagrams/Storage.drawio.svg | 1502 +++++++++-------- .../storable/CompilerStorage.java | 1 - src/main/java/storage/Storage.java | 1 - .../UnsupportedValueException.java | 2 +- .../StorageValueAdapter.java | 13 - .../value_formatters/ValueFormatter.java | 2 +- .../ValueToStringFormatter.java | 2 +- .../ValueToStringFormatterTests.java | 2 +- .../TestIntegerValueFormatter.java | 2 +- .../TestStringErrorValueFormatter.java | 2 +- .../TestStringValueFormatter.java | 2 +- 11 files changed, 800 insertions(+), 731 deletions(-) rename src/main/java/storage/{storage_value_adapters => exceptions}/UnsupportedValueException.java (93%) delete mode 100644 src/main/java/storage/storage_value_adapters/StorageValueAdapter.java diff --git a/docs/diagrams/Storage.drawio.svg b/docs/diagrams/Storage.drawio.svg index 174ce39..848f066 100644 --- a/docs/diagrams/Storage.drawio.svg +++ b/docs/diagrams/Storage.drawio.svg @@ -1,719 +1,803 @@ - + + - - - - - - - -
-
-
- Storable <I> -
-
-
-
- - Storable <... - -
-
-
- - - - - - - - - -
-
-
+ + + + + + + + + + +
+
+
+ Storable <I> +
+
+
+
+ + + Storable + + + <I> + + +
+
+
+
+ + + + + + + + + + +
+
+
+ Storage Values +
+
+
+
+ Storage Values -
-
-
-
- - Storage Values - -
-
-
- - - - - - - -
-
-
- StorageValue<T> -
- <A> -
-
-
-
- - StorageValue<T>... - -
-
-
- - - - - - - -
-
-
- StringStorageValue -
-
-
-
- - StringStorageValue - -
-
-
- - - - - - - - -
-
-
- Extends -
-
-
-
- - Extends - -
-
-
- - - - - - - - - - - - -
-
-
+ + + + + + + + + + + + +
+
+
+ StorageValue<T> +
+ <A> +
+
+
+
+ + + StorageValue<T> + + + <A> + + +
+
+
+
+ + + + + + + + +
+
+
+ StringStorageValue +
+
+
+
+ + StringStorageValue + +
+
+
+
+ + + + + + + + + +
+
+
+ Extends +
+
+
+
+ + Extends + +
+
+
+
+ + + + + + + + + + + + + + + + +
+
+
+ Value Formatters +
+
+
+
+ Value Formatters -
-
-
-
- - Value Formatters - -
-
-
- - - - - - - -
-
-
- ValueFormatter<T> -
- <I> -
-
-
-
- - ValueFormatter<T>... - -
-
-
- - - - - - - -
-
-
- ValueToStringFormatter -
-
-
-
- - ValueToStringFormatter - -
-
-
- - - - - - - - -
-
-
- Extends -
-
-
-
- - Extends - -
-
-
- - - - - - - -
-
-
- Loadable <I> -
-
-
-
- - Loadable <... - -
-
-
- - - - - - - - -
-
-
- Produces a set of -
-
-
-
- - Produces a set of - -
-
-
- - - - - - - -
-
-
+ + + + + + + + + + + + +
+
+
+ ValueFormatter<T> +
+ <I> +
+
+
+
+ + + ValueFormatter<T> + + + <I> + + +
+
+
+
+ + + + + + + + +
+
+
+ ValueToStringFormatter +
+
+
+
+ + ValueToStringFormatter + +
+
+
+
+ + + + + + + + + +
+
+
+ Extends +
+
+
+
+ + Extends + +
+
+
+
+ + + + + + + + + +
+
+
+ Loadable <I> +
+
+
+
+ + + Loadable + + + <I> + + +
+
+
+
+ + + + + + + + + + +
+
+
+ Produces a set of +
+
+
+
+ + Produces a set of + +
+
+
+
+
+ + + + + + + + +
+
+
+ Component +
+
+
+
+ Component -
-
-
-
- - Component - -
-
-
- - - - - - - - - -
-
-
- Storage Value Adapters -
-
-
-
- - Storage Value Adapters - -
-
-
- - - - - - - -
-
-
- StorageValueAdapter <I> -
-
-
-
- - StorageValueAdapter <... - -
-
-
- - - - - - - -
-
-
- StringValueToString -
-
-
-
- - StringValueToString - -
-
-
- - - - - - - -
-
-
- UnsupportedValueException -
-
-
-
- - UnsupportedValueException - -
-
-
- - - - - - - - - - - - -
-
-
- Passed into -
-
-
-
- - Passed into - -
-
-
- - - - - - - -
-
-
- RuntimeException -
-
-
-
- - RuntimeException - -
-
-
- - - - - - - - -
-
-
- Extends -
-
-
-
- - Extends - -
-
-
- - - - - - - - - - - - -
-
-
- Throws -
-
-
-
- - Throws - -
-
-
- - - - - - - - -
-
-
- String Data Stream -
-
-
-
- - String Data... - -
-
-
- - - - - - - - -
-
-
- Produces -
-
-
-
- - Produces - -
-
-
- - - - - - - - - - - -
-
-
- Storage Representation -
-
-
-
- - Storage Represen... - -
-
-
- - - - - - - - - -
-
-
+ + + + + + + + + + + + + + + +
+
+
+ Exceptions +
+
+
+
+ + Exceptions + +
+
+
+ + + + + + + + +
+
+
+ UnsupportedValueException +
+
+
+
+ + UnsupportedValueException + +
+
+
+
+ + + + + + + + +
+
+
+ RuntimeException +
+
+
+
+ + RuntimeException + +
+
+
+
+ + + + + + + + + +
+
+
+ Extends +
+
+
+
+ + Extends + +
+
+
+
+
+ + + + + + + + + + +
+
+
+ Passed into +
+
+
+
+ + Passed into + +
+
+
+
+
+ + + + + + + + + + +
+
+
+ Throws +
+
+
+
+ + Throws + +
+
+
+
+
+ + + + + + + + + +
+
+
+ String Data Stream +
+
+
+
+ + + String Data + + + Stream + + +
+
+
+
+ + + + + + + + + + +
+
+
+ Produces +
+
+
+
+ + Produces + +
+
+
+
+
+ + + + + + + + + + + + + + +
+
+
+ Storage Representation +
+
+
+
+ + + Storage + + + Representation + + +
+
+
+
+ + + + + + + + + + +
+
+
+ Stream Editors +
+
+
+
+ Stream Editors -
-
-
-
- - Stream Editors - -
-
-
- - - - - - - -
-
-
- StreamWriter<T> -
- <I> -
-
-
-
- - StreamWriter<T>... - -
-
-
- - - - - - - -
-
-
- StringStreamWriter -
-
-
-
- - StringStreamWriter - -
-
-
- - - - - - - -
-
-
- StreamReader<T> -
- <I> -
-
-
-
- - StreamReader<T>... - -
-
-
- - - - - - - -
-
-
- StreamEditor<T> -
- <A> -
-
-
-
- - StreamEditor<T>... - -
-
-
- - - - - - - - -
-
-
- Extends -
-
-
-
- - Extends - -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- Text -
-
-
-
- - Text - -
-
-
- - - - - - - - -
-
-
+ + + + + + + + + + + + +
+
+
+ StreamWriter<T> +
+ <I> +
+
+
+
+ + + StreamWriter<T> + + + <I> + + +
+
+
+
+ + + + + + + + +
+
+
+ StringStreamWriter +
+
+
+
+ + StringStreamWriter + +
+
+
+
+ + + + + + + + +
+
+
+ StreamReader<T> +
+ <I> +
+
+
+
+ + + StreamReader<T> + + + <I> + + +
+
+
+
+ + + + + + + + +
+
+
+ StreamEditor<T> +
+ <A> +
+
+
+
+ + + StreamEditor<T> + + + <A> + + +
+
+
+
+ + + + + + + + + +
+
+
+ Extends +
+
+
+
+ + Extends + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ Text +
+
+
+
+ + Text + +
+
+
+
+
+ + + + + + + + + +
+
+
+ Data File +
+
+
+
+ Data File -
-
-
-
- - Data File - -
+ + +
+
+
diff --git a/src/main/java/component_construction/storable/CompilerStorage.java b/src/main/java/component_construction/storable/CompilerStorage.java index 91f5465..10994cc 100644 --- a/src/main/java/component_construction/storable/CompilerStorage.java +++ b/src/main/java/component_construction/storable/CompilerStorage.java @@ -8,7 +8,6 @@ import storage.exceptions.*; import storage.external_interfaces.Loadable; import storage.file_editors.*; -import storage.storage_value_adapters.UnsupportedValueException; import storage.storage_values.StorageValue; import storage.value_formatters.ValueFormatter; diff --git a/src/main/java/storage/Storage.java b/src/main/java/storage/Storage.java index 42b8ad8..6ea6640 100644 --- a/src/main/java/storage/Storage.java +++ b/src/main/java/storage/Storage.java @@ -8,7 +8,6 @@ import storage.exceptions.*; import storage.file_editors.*; import storage.external_interfaces.*; -import storage.storage_value_adapters.UnsupportedValueException; import storage.storage_values.StorageValue; import storage.value_formatters.*; diff --git a/src/main/java/storage/storage_value_adapters/UnsupportedValueException.java b/src/main/java/storage/exceptions/UnsupportedValueException.java similarity index 93% rename from src/main/java/storage/storage_value_adapters/UnsupportedValueException.java rename to src/main/java/storage/exceptions/UnsupportedValueException.java index a0fe439..b6d1097 100644 --- a/src/main/java/storage/storage_value_adapters/UnsupportedValueException.java +++ b/src/main/java/storage/exceptions/UnsupportedValueException.java @@ -1,4 +1,4 @@ -package storage.storage_value_adapters; +package storage.exceptions; import storage.storage_values.StorageValue; diff --git a/src/main/java/storage/storage_value_adapters/StorageValueAdapter.java b/src/main/java/storage/storage_value_adapters/StorageValueAdapter.java deleted file mode 100644 index d9e70cf..0000000 --- a/src/main/java/storage/storage_value_adapters/StorageValueAdapter.java +++ /dev/null @@ -1,13 +0,0 @@ -package storage.storage_value_adapters; - -import storage.storage_values.StorageValue; - -/** - * An interface that defines an adapter converting StorageValues to a chosen representation for use within a StorageMethod - */ -public interface StorageValueAdapter { - - public E retreiveValue(StorageValue storageValue); - public StorageValue packageValue(E value); - -} diff --git a/src/main/java/storage/value_formatters/ValueFormatter.java b/src/main/java/storage/value_formatters/ValueFormatter.java index 575b5cb..c1a719d 100644 --- a/src/main/java/storage/value_formatters/ValueFormatter.java +++ b/src/main/java/storage/value_formatters/ValueFormatter.java @@ -1,6 +1,6 @@ package storage.value_formatters; -import storage.storage_value_adapters.UnsupportedValueException; +import storage.exceptions.UnsupportedValueException; import storage.storage_values.StorageValue; /** diff --git a/src/main/java/storage/value_formatters/ValueToStringFormatter.java b/src/main/java/storage/value_formatters/ValueToStringFormatter.java index 0102e75..e936e2a 100644 --- a/src/main/java/storage/value_formatters/ValueToStringFormatter.java +++ b/src/main/java/storage/value_formatters/ValueToStringFormatter.java @@ -3,7 +3,7 @@ import java.util.*; import java.util.Map.Entry; -import storage.storage_value_adapters.UnsupportedValueException; +import storage.exceptions.UnsupportedValueException; import storage.storage_values.*; /** diff --git a/src/test/java/storage/value_formatters/ValueToStringFormatterTests.java b/src/test/java/storage/value_formatters/ValueToStringFormatterTests.java index 2aabfc3..fed17e1 100644 --- a/src/test/java/storage/value_formatters/ValueToStringFormatterTests.java +++ b/src/test/java/storage/value_formatters/ValueToStringFormatterTests.java @@ -5,7 +5,7 @@ import org.junit.jupiter.api.Test; import helper_objects.*; -import storage.storage_value_adapters.UnsupportedValueException; +import storage.exceptions.UnsupportedValueException; import storage.storage_values.*; public class ValueToStringFormatterTests { diff --git a/src/test/java/test_aids/test_storage/TestIntegerValueFormatter.java b/src/test/java/test_aids/test_storage/TestIntegerValueFormatter.java index 5690cec..d1039c3 100644 --- a/src/test/java/test_aids/test_storage/TestIntegerValueFormatter.java +++ b/src/test/java/test_aids/test_storage/TestIntegerValueFormatter.java @@ -1,6 +1,6 @@ package test_aids.test_storage; -import storage.storage_value_adapters.UnsupportedValueException; +import storage.exceptions.UnsupportedValueException; import storage.storage_values.StorageValue; import storage.value_formatters.ValueFormatter; diff --git a/src/test/java/test_aids/test_storage/TestStringErrorValueFormatter.java b/src/test/java/test_aids/test_storage/TestStringErrorValueFormatter.java index b8609e1..4a9d14c 100644 --- a/src/test/java/test_aids/test_storage/TestStringErrorValueFormatter.java +++ b/src/test/java/test_aids/test_storage/TestStringErrorValueFormatter.java @@ -1,6 +1,6 @@ package test_aids.test_storage; -import storage.storage_value_adapters.UnsupportedValueException; +import storage.exceptions.UnsupportedValueException; import storage.storage_values.StorageValue; import storage.value_formatters.ValueFormatter; import test_aids.exceptions.ExampleException; diff --git a/src/test/java/test_aids/test_storage/TestStringValueFormatter.java b/src/test/java/test_aids/test_storage/TestStringValueFormatter.java index 4c97d38..2b3b448 100644 --- a/src/test/java/test_aids/test_storage/TestStringValueFormatter.java +++ b/src/test/java/test_aids/test_storage/TestStringValueFormatter.java @@ -1,6 +1,6 @@ package test_aids.test_storage; -import storage.storage_value_adapters.UnsupportedValueException; +import storage.exceptions.UnsupportedValueException; import storage.storage_values.StorageValue; import storage.value_formatters.ValueFormatter; From 6e1d12b8be29b245685b3b6b87262729f0230622 Mon Sep 17 00:00:00 2001 From: warburec <77669019+warburec@users.noreply.github.com> Date: Fri, 2 Oct 2026 19:05:37 +0100 Subject: [PATCH 3/6] Storage code snippet added to README --- src/main/java/storage/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/storage/README.md b/src/main/java/storage/README.md index 89b5620..5fdd6a3 100644 --- a/src/main/java/storage/README.md +++ b/src/main/java/storage/README.md @@ -6,6 +6,16 @@ Objects can produce a `StroageValue` representation of their state. This stat Stored state may be loaded through the `Storable` helper, and may be used to hydrate objects through the `Loadable` interface. +```java +Storage storage = new Storage() + .setTargetPath("./testFilepath.bin") + .setFileEditor(new ExampleStreamEditor()) + .setFormatter(new ExampleValueFormatter()); + +storage.store(someStorable); +storage.loadInto(new ExampleLoadable()); +``` + ## Diagrams ### Usage Pipeline ![Usage Pipeline Diagram](/docs/diagrams/StorageUsagePipeline.drawio.svg) From 718b57fefe13163d0dde39c89628e337927e3144 Mon Sep 17 00:00:00 2001 From: warburec <77669019+warburec@users.noreply.github.com> Date: Wed, 7 Oct 2026 23:09:44 +0100 Subject: [PATCH 4/6] Moving of dynamic_loading storage helpers into storage folder --- .../storable/StorableCustomCompiler.java | 2 +- .../storable/factories/StorableCustomCompilerFactory.java | 3 +-- .../factories => storage/dynamic_loading}/Factory.java | 2 +- .../storable => storage}/dynamic_loading/LoadableBy.java | 4 ++-- .../storable => storage}/dynamic_loading/Loader.java | 5 ++--- .../dynamic_loading/ReflectiveClassConstructor.java | 2 +- .../dynamic_loading/ReflectivelyLoadable.java | 2 +- .../exceptions/IncorrectlyFormattedException.java | 2 +- .../exceptions/MissingEmptyConstructorException.java | 4 ++-- .../factories/StorableCustomCompilerFactoryTests.java | 1 + .../dynamic_loading/LoadableByTests.java | 6 ++++-- .../storable => storage}/dynamic_loading/LoaderTests.java | 5 +++-- .../dynamic_loading/ReflectiveClassConstructorTests.java | 3 ++- .../test_aids/storage_entities/IncorrectlyFormedLoader.java | 2 +- .../java/test_aids/storage_entities/TestObjectLoader.java | 2 +- .../loadable/LoadableStorableCustomCodeGenerator.java | 2 +- .../loadable/LoadableStorableCustomLexicalAnalyser.java | 2 +- .../loadable/LoadableStorableCustomSyntaxAnalyser.java | 2 +- .../loadableBy/LoadableByCustomLexicalAnalyserLoader.java | 2 +- .../loadableBy/LoadableByStorableCustomLexicalAnalyser.java | 2 +- .../ConcretisedGenericTestLoadableObject.java | 2 +- .../storage_entities/loadableby_entities/GenericLoader.java | 2 +- .../loadableby_entities/GenericTestLoadableObject.java | 2 +- .../loadableby_entities/GenericallyLoadableObject.java | 2 +- .../loadableby_entities/LoadableObject.java | 2 +- .../loadableby_entities/StandardLoader.java | 2 +- .../loadableby_entities/TestLoadableObject.java | 2 +- .../loadableby_entities/WildcardLoadableObject.java | 2 +- 28 files changed, 37 insertions(+), 34 deletions(-) rename src/main/java/{component_construction/storable/factories => storage/dynamic_loading}/Factory.java (84%) rename src/main/java/{component_construction/storable => storage}/dynamic_loading/LoadableBy.java (94%) rename src/main/java/{component_construction/storable => storage}/dynamic_loading/Loader.java (87%) rename src/main/java/{component_construction/storable => storage}/dynamic_loading/ReflectiveClassConstructor.java (98%) rename src/main/java/{component_construction/storable => storage}/dynamic_loading/ReflectivelyLoadable.java (78%) rename src/main/java/{component_construction/storable => storage}/exceptions/IncorrectlyFormattedException.java (75%) rename src/main/java/{component_construction/storable => storage}/exceptions/MissingEmptyConstructorException.java (71%) rename src/test/java/{component_construction/storable => storage}/dynamic_loading/LoadableByTests.java (94%) rename src/test/java/{component_construction/storable => storage}/dynamic_loading/LoaderTests.java (83%) rename src/test/java/{component_construction/storable => storage}/dynamic_loading/ReflectiveClassConstructorTests.java (99%) diff --git a/src/main/java/component_construction/storable/StorableCustomCompiler.java b/src/main/java/component_construction/storable/StorableCustomCompiler.java index bfcdf7b..c114ec6 100644 --- a/src/main/java/component_construction/storable/StorableCustomCompiler.java +++ b/src/main/java/component_construction/storable/StorableCustomCompiler.java @@ -4,11 +4,11 @@ import code_generation.CodeGenerator; import component_construction.custom_components.*; -import component_construction.storable.dynamic_loading.LoadableBy; import component_construction.storable.exceptions.NonStorableComponentException; import component_construction.storable.factories.StorableCustomCompilerFactory; import component_construction.storable.StorableCustomCompiler; import lexical_analysis.LexicalAnalyser; +import storage.dynamic_loading.LoadableBy; import storage.external_interfaces.Storable; import storage.storage_values.*; import syntax_analysis.SyntaxAnalyser; diff --git a/src/main/java/component_construction/storable/factories/StorableCustomCompilerFactory.java b/src/main/java/component_construction/storable/factories/StorableCustomCompilerFactory.java index 9a01a72..d90491e 100644 --- a/src/main/java/component_construction/storable/factories/StorableCustomCompilerFactory.java +++ b/src/main/java/component_construction/storable/factories/StorableCustomCompilerFactory.java @@ -4,10 +4,9 @@ import code_generation.CodeGenerator; import component_construction.storable.StorableCustomCompiler; -import component_construction.storable.dynamic_loading.*; import component_construction.storable.exceptions.*; -import component_construction.storable.factories.Factory; import lexical_analysis.LexicalAnalyser; +import storage.dynamic_loading.*; import storage.storage_values.*; import syntax_analysis.SyntaxAnalyser; diff --git a/src/main/java/component_construction/storable/factories/Factory.java b/src/main/java/storage/dynamic_loading/Factory.java similarity index 84% rename from src/main/java/component_construction/storable/factories/Factory.java rename to src/main/java/storage/dynamic_loading/Factory.java index 892b688..fe704a3 100644 --- a/src/main/java/component_construction/storable/factories/Factory.java +++ b/src/main/java/storage/dynamic_loading/Factory.java @@ -1,4 +1,4 @@ -package component_construction.storable.factories; +package storage.dynamic_loading; import storage.storage_values.StorageValue; diff --git a/src/main/java/component_construction/storable/dynamic_loading/LoadableBy.java b/src/main/java/storage/dynamic_loading/LoadableBy.java similarity index 94% rename from src/main/java/component_construction/storable/dynamic_loading/LoadableBy.java rename to src/main/java/storage/dynamic_loading/LoadableBy.java index f9e3839..e3faf38 100644 --- a/src/main/java/component_construction/storable/dynamic_loading/LoadableBy.java +++ b/src/main/java/storage/dynamic_loading/LoadableBy.java @@ -1,8 +1,8 @@ -package component_construction.storable.dynamic_loading; +package storage.dynamic_loading; import java.lang.reflect.*; -import component_construction.storable.exceptions.IncorrectlyFormattedException; +import storage.exceptions.IncorrectlyFormattedException; /** * A class specifying a designated loader for the current class. diff --git a/src/main/java/component_construction/storable/dynamic_loading/Loader.java b/src/main/java/storage/dynamic_loading/Loader.java similarity index 87% rename from src/main/java/component_construction/storable/dynamic_loading/Loader.java rename to src/main/java/storage/dynamic_loading/Loader.java index dd13bce..8a4ecf8 100644 --- a/src/main/java/component_construction/storable/dynamic_loading/Loader.java +++ b/src/main/java/storage/dynamic_loading/Loader.java @@ -1,9 +1,8 @@ -package component_construction.storable.dynamic_loading; +package storage.dynamic_loading; import java.lang.reflect.InvocationTargetException; -import component_construction.storable.exceptions.MissingEmptyConstructorException; -import component_construction.storable.factories.Factory; +import storage.exceptions.MissingEmptyConstructorException; /** * An interface defining the ability construct objects of the specified type diff --git a/src/main/java/component_construction/storable/dynamic_loading/ReflectiveClassConstructor.java b/src/main/java/storage/dynamic_loading/ReflectiveClassConstructor.java similarity index 98% rename from src/main/java/component_construction/storable/dynamic_loading/ReflectiveClassConstructor.java rename to src/main/java/storage/dynamic_loading/ReflectiveClassConstructor.java index e9ccfdf..4551472 100644 --- a/src/main/java/component_construction/storable/dynamic_loading/ReflectiveClassConstructor.java +++ b/src/main/java/storage/dynamic_loading/ReflectiveClassConstructor.java @@ -1,4 +1,4 @@ -package component_construction.storable.dynamic_loading; +package storage.dynamic_loading; import java.lang.reflect.InvocationTargetException; import java.util.*; diff --git a/src/main/java/component_construction/storable/dynamic_loading/ReflectivelyLoadable.java b/src/main/java/storage/dynamic_loading/ReflectivelyLoadable.java similarity index 78% rename from src/main/java/component_construction/storable/dynamic_loading/ReflectivelyLoadable.java rename to src/main/java/storage/dynamic_loading/ReflectivelyLoadable.java index 0e61c86..19b2ce5 100644 --- a/src/main/java/component_construction/storable/dynamic_loading/ReflectivelyLoadable.java +++ b/src/main/java/storage/dynamic_loading/ReflectivelyLoadable.java @@ -1,4 +1,4 @@ -package component_construction.storable.dynamic_loading; +package storage.dynamic_loading; import storage.external_interfaces.Loadable; diff --git a/src/main/java/component_construction/storable/exceptions/IncorrectlyFormattedException.java b/src/main/java/storage/exceptions/IncorrectlyFormattedException.java similarity index 75% rename from src/main/java/component_construction/storable/exceptions/IncorrectlyFormattedException.java rename to src/main/java/storage/exceptions/IncorrectlyFormattedException.java index 5890745..4c60a6d 100644 --- a/src/main/java/component_construction/storable/exceptions/IncorrectlyFormattedException.java +++ b/src/main/java/storage/exceptions/IncorrectlyFormattedException.java @@ -1,4 +1,4 @@ -package component_construction.storable.exceptions; +package storage.exceptions; public class IncorrectlyFormattedException extends RuntimeException { diff --git a/src/main/java/component_construction/storable/exceptions/MissingEmptyConstructorException.java b/src/main/java/storage/exceptions/MissingEmptyConstructorException.java similarity index 71% rename from src/main/java/component_construction/storable/exceptions/MissingEmptyConstructorException.java rename to src/main/java/storage/exceptions/MissingEmptyConstructorException.java index c143e05..9809de6 100644 --- a/src/main/java/component_construction/storable/exceptions/MissingEmptyConstructorException.java +++ b/src/main/java/storage/exceptions/MissingEmptyConstructorException.java @@ -1,6 +1,6 @@ -package component_construction.storable.exceptions; +package storage.exceptions; -import component_construction.storable.dynamic_loading.Loader; +import storage.dynamic_loading.Loader; public class MissingEmptyConstructorException extends RuntimeException { diff --git a/src/test/java/component_construction/storable/factories/StorableCustomCompilerFactoryTests.java b/src/test/java/component_construction/storable/factories/StorableCustomCompilerFactoryTests.java index 8368ab5..4b45fa6 100644 --- a/src/test/java/component_construction/storable/factories/StorableCustomCompilerFactoryTests.java +++ b/src/test/java/component_construction/storable/factories/StorableCustomCompilerFactoryTests.java @@ -7,6 +7,7 @@ import code_generation.CodeGenerator; import component_construction.storable.exceptions.*; import lexical_analysis.LexicalAnalyser; +import storage.dynamic_loading.Factory; import storage.storage_values.*; import syntax_analysis.SyntaxAnalyser; import test_aids.storage_entities.custom_components.*; diff --git a/src/test/java/component_construction/storable/dynamic_loading/LoadableByTests.java b/src/test/java/storage/dynamic_loading/LoadableByTests.java similarity index 94% rename from src/test/java/component_construction/storable/dynamic_loading/LoadableByTests.java rename to src/test/java/storage/dynamic_loading/LoadableByTests.java index 07b9de8..162e6d2 100644 --- a/src/test/java/component_construction/storable/dynamic_loading/LoadableByTests.java +++ b/src/test/java/storage/dynamic_loading/LoadableByTests.java @@ -1,9 +1,11 @@ -package component_construction.storable.dynamic_loading; +package storage.dynamic_loading; import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; -import component_construction.storable.exceptions.IncorrectlyFormattedException; +import storage.dynamic_loading.LoadableBy; +import storage.dynamic_loading.Loader; +import storage.exceptions.IncorrectlyFormattedException; import test_aids.storage_entities.loadableby_entities.*; public class LoadableByTests { diff --git a/src/test/java/component_construction/storable/dynamic_loading/LoaderTests.java b/src/test/java/storage/dynamic_loading/LoaderTests.java similarity index 83% rename from src/test/java/component_construction/storable/dynamic_loading/LoaderTests.java rename to src/test/java/storage/dynamic_loading/LoaderTests.java index fca3c0e..8e86bc8 100644 --- a/src/test/java/component_construction/storable/dynamic_loading/LoaderTests.java +++ b/src/test/java/storage/dynamic_loading/LoaderTests.java @@ -1,9 +1,10 @@ -package component_construction.storable.dynamic_loading; +package storage.dynamic_loading; import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; -import component_construction.storable.exceptions.MissingEmptyConstructorException; +import storage.dynamic_loading.Loader; +import storage.exceptions.MissingEmptyConstructorException; import test_aids.storage_entities.*; public class LoaderTests { diff --git a/src/test/java/component_construction/storable/dynamic_loading/ReflectiveClassConstructorTests.java b/src/test/java/storage/dynamic_loading/ReflectiveClassConstructorTests.java similarity index 99% rename from src/test/java/component_construction/storable/dynamic_loading/ReflectiveClassConstructorTests.java rename to src/test/java/storage/dynamic_loading/ReflectiveClassConstructorTests.java index d0c7ad8..f39ceb5 100644 --- a/src/test/java/component_construction/storable/dynamic_loading/ReflectiveClassConstructorTests.java +++ b/src/test/java/storage/dynamic_loading/ReflectiveClassConstructorTests.java @@ -1,8 +1,9 @@ -package component_construction.storable.dynamic_loading; +package storage.dynamic_loading; import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import storage.dynamic_loading.ReflectiveClassConstructor; import test_aids.storage_entities.*; import test_aids.storage_entities.TestDynamicObject.*; diff --git a/src/test/java/test_aids/storage_entities/IncorrectlyFormedLoader.java b/src/test/java/test_aids/storage_entities/IncorrectlyFormedLoader.java index f5450e3..60aeaaf 100644 --- a/src/test/java/test_aids/storage_entities/IncorrectlyFormedLoader.java +++ b/src/test/java/test_aids/storage_entities/IncorrectlyFormedLoader.java @@ -1,6 +1,6 @@ package test_aids.storage_entities; -import component_construction.storable.dynamic_loading.Loader; +import storage.dynamic_loading.Loader; import storage.storage_values.StorageValue; public class IncorrectlyFormedLoader implements Loader { diff --git a/src/test/java/test_aids/storage_entities/TestObjectLoader.java b/src/test/java/test_aids/storage_entities/TestObjectLoader.java index f2846fd..4f8dd84 100644 --- a/src/test/java/test_aids/storage_entities/TestObjectLoader.java +++ b/src/test/java/test_aids/storage_entities/TestObjectLoader.java @@ -1,6 +1,6 @@ package test_aids.storage_entities; -import component_construction.storable.dynamic_loading.Loader; +import storage.dynamic_loading.Loader; import storage.storage_values.StorageValue; public class TestObjectLoader implements Loader { diff --git a/src/test/java/test_aids/storage_entities/custom_components/loadable/LoadableStorableCustomCodeGenerator.java b/src/test/java/test_aids/storage_entities/custom_components/loadable/LoadableStorableCustomCodeGenerator.java index 1d15bcf..7a5933f 100644 --- a/src/test/java/test_aids/storage_entities/custom_components/loadable/LoadableStorableCustomCodeGenerator.java +++ b/src/test/java/test_aids/storage_entities/custom_components/loadable/LoadableStorableCustomCodeGenerator.java @@ -1,7 +1,7 @@ package test_aids.storage_entities.custom_components.loadable; import code_generation.CodeGenerator; -import component_construction.storable.dynamic_loading.ReflectivelyLoadable; +import storage.dynamic_loading.ReflectivelyLoadable; import storage.external_interfaces.*; import storage.storage_values.*; import syntax_analysis.parsing.ParseState; diff --git a/src/test/java/test_aids/storage_entities/custom_components/loadable/LoadableStorableCustomLexicalAnalyser.java b/src/test/java/test_aids/storage_entities/custom_components/loadable/LoadableStorableCustomLexicalAnalyser.java index 4a89fd4..84e7721 100644 --- a/src/test/java/test_aids/storage_entities/custom_components/loadable/LoadableStorableCustomLexicalAnalyser.java +++ b/src/test/java/test_aids/storage_entities/custom_components/loadable/LoadableStorableCustomLexicalAnalyser.java @@ -1,8 +1,8 @@ package test_aids.storage_entities.custom_components.loadable; -import component_construction.storable.dynamic_loading.ReflectivelyLoadable; import grammar_objects.Token; import lexical_analysis.LexicalAnalyser; +import storage.dynamic_loading.ReflectivelyLoadable; import storage.external_interfaces.Storable; import storage.storage_values.*; diff --git a/src/test/java/test_aids/storage_entities/custom_components/loadable/LoadableStorableCustomSyntaxAnalyser.java b/src/test/java/test_aids/storage_entities/custom_components/loadable/LoadableStorableCustomSyntaxAnalyser.java index 68eb5a2..abf34d3 100644 --- a/src/test/java/test_aids/storage_entities/custom_components/loadable/LoadableStorableCustomSyntaxAnalyser.java +++ b/src/test/java/test_aids/storage_entities/custom_components/loadable/LoadableStorableCustomSyntaxAnalyser.java @@ -1,7 +1,7 @@ package test_aids.storage_entities.custom_components.loadable; -import component_construction.storable.dynamic_loading.ReflectivelyLoadable; import grammar_objects.Token; +import storage.dynamic_loading.ReflectivelyLoadable; import storage.external_interfaces.*; import storage.storage_values.*; import syntax_analysis.SyntaxAnalyser; diff --git a/src/test/java/test_aids/storage_entities/custom_components/loadableBy/LoadableByCustomLexicalAnalyserLoader.java b/src/test/java/test_aids/storage_entities/custom_components/loadableBy/LoadableByCustomLexicalAnalyserLoader.java index f0feff2..034341c 100644 --- a/src/test/java/test_aids/storage_entities/custom_components/loadableBy/LoadableByCustomLexicalAnalyserLoader.java +++ b/src/test/java/test_aids/storage_entities/custom_components/loadableBy/LoadableByCustomLexicalAnalyserLoader.java @@ -1,6 +1,6 @@ package test_aids.storage_entities.custom_components.loadableBy; -import component_construction.storable.dynamic_loading.Loader; +import storage.dynamic_loading.Loader; import storage.storage_values.StorageValue; public class LoadableByCustomLexicalAnalyserLoader implements Loader { diff --git a/src/test/java/test_aids/storage_entities/custom_components/loadableBy/LoadableByStorableCustomLexicalAnalyser.java b/src/test/java/test_aids/storage_entities/custom_components/loadableBy/LoadableByStorableCustomLexicalAnalyser.java index 4029e49..b91d67d 100644 --- a/src/test/java/test_aids/storage_entities/custom_components/loadableBy/LoadableByStorableCustomLexicalAnalyser.java +++ b/src/test/java/test_aids/storage_entities/custom_components/loadableBy/LoadableByStorableCustomLexicalAnalyser.java @@ -1,8 +1,8 @@ package test_aids.storage_entities.custom_components.loadableBy; -import component_construction.storable.dynamic_loading.LoadableBy; import grammar_objects.Token; import lexical_analysis.LexicalAnalyser; +import storage.dynamic_loading.LoadableBy; import storage.external_interfaces.Storable; import storage.storage_values.*; diff --git a/src/test/java/test_aids/storage_entities/loadableby_entities/ConcretisedGenericTestLoadableObject.java b/src/test/java/test_aids/storage_entities/loadableby_entities/ConcretisedGenericTestLoadableObject.java index 2c0256e..29e9039 100644 --- a/src/test/java/test_aids/storage_entities/loadableby_entities/ConcretisedGenericTestLoadableObject.java +++ b/src/test/java/test_aids/storage_entities/loadableby_entities/ConcretisedGenericTestLoadableObject.java @@ -1,5 +1,5 @@ package test_aids.storage_entities.loadableby_entities; -import component_construction.storable.dynamic_loading.LoadableBy; +import storage.dynamic_loading.LoadableBy; public class ConcretisedGenericTestLoadableObject extends StandardLoader implements GenercicTestInterface, LoadableBy {} \ No newline at end of file diff --git a/src/test/java/test_aids/storage_entities/loadableby_entities/GenericLoader.java b/src/test/java/test_aids/storage_entities/loadableby_entities/GenericLoader.java index ecad6e0..4c880df 100644 --- a/src/test/java/test_aids/storage_entities/loadableby_entities/GenericLoader.java +++ b/src/test/java/test_aids/storage_entities/loadableby_entities/GenericLoader.java @@ -1,6 +1,6 @@ package test_aids.storage_entities.loadableby_entities; -import component_construction.storable.dynamic_loading.Loader; +import storage.dynamic_loading.Loader; import storage.storage_values.StorageValue; public class GenericLoader implements Loader { diff --git a/src/test/java/test_aids/storage_entities/loadableby_entities/GenericTestLoadableObject.java b/src/test/java/test_aids/storage_entities/loadableby_entities/GenericTestLoadableObject.java index cbc0066..76a3ad2 100644 --- a/src/test/java/test_aids/storage_entities/loadableby_entities/GenericTestLoadableObject.java +++ b/src/test/java/test_aids/storage_entities/loadableby_entities/GenericTestLoadableObject.java @@ -1,5 +1,5 @@ package test_aids.storage_entities.loadableby_entities; -import component_construction.storable.dynamic_loading.LoadableBy; +import storage.dynamic_loading.LoadableBy; public class GenericTestLoadableObject extends StandardLoader implements GenercicTestInterface, LoadableBy {} \ No newline at end of file diff --git a/src/test/java/test_aids/storage_entities/loadableby_entities/GenericallyLoadableObject.java b/src/test/java/test_aids/storage_entities/loadableby_entities/GenericallyLoadableObject.java index e0f5144..6a0606b 100644 --- a/src/test/java/test_aids/storage_entities/loadableby_entities/GenericallyLoadableObject.java +++ b/src/test/java/test_aids/storage_entities/loadableby_entities/GenericallyLoadableObject.java @@ -1,6 +1,6 @@ package test_aids.storage_entities.loadableby_entities; -import component_construction.storable.dynamic_loading.LoadableBy; +import storage.dynamic_loading.LoadableBy; public record GenericallyLoadableObject(int a) implements LoadableBy> {} diff --git a/src/test/java/test_aids/storage_entities/loadableby_entities/LoadableObject.java b/src/test/java/test_aids/storage_entities/loadableby_entities/LoadableObject.java index 0bc390f..1d7189c 100644 --- a/src/test/java/test_aids/storage_entities/loadableby_entities/LoadableObject.java +++ b/src/test/java/test_aids/storage_entities/loadableby_entities/LoadableObject.java @@ -1,6 +1,6 @@ package test_aids.storage_entities.loadableby_entities; -import component_construction.storable.dynamic_loading.LoadableBy; +import storage.dynamic_loading.LoadableBy; public record LoadableObject(int a) implements LoadableBy {} diff --git a/src/test/java/test_aids/storage_entities/loadableby_entities/StandardLoader.java b/src/test/java/test_aids/storage_entities/loadableby_entities/StandardLoader.java index 9e6d86c..9158616 100644 --- a/src/test/java/test_aids/storage_entities/loadableby_entities/StandardLoader.java +++ b/src/test/java/test_aids/storage_entities/loadableby_entities/StandardLoader.java @@ -1,6 +1,6 @@ package test_aids.storage_entities.loadableby_entities; -import component_construction.storable.dynamic_loading.Loader; +import storage.dynamic_loading.Loader; import storage.storage_values.StorageValue; public class StandardLoader implements Loader { diff --git a/src/test/java/test_aids/storage_entities/loadableby_entities/TestLoadableObject.java b/src/test/java/test_aids/storage_entities/loadableby_entities/TestLoadableObject.java index 09e60b5..f538369 100644 --- a/src/test/java/test_aids/storage_entities/loadableby_entities/TestLoadableObject.java +++ b/src/test/java/test_aids/storage_entities/loadableby_entities/TestLoadableObject.java @@ -1,5 +1,5 @@ package test_aids.storage_entities.loadableby_entities; -import component_construction.storable.dynamic_loading.LoadableBy; +import storage.dynamic_loading.LoadableBy; public class TestLoadableObject extends StandardLoader implements TestInterface, LoadableBy {} \ No newline at end of file diff --git a/src/test/java/test_aids/storage_entities/loadableby_entities/WildcardLoadableObject.java b/src/test/java/test_aids/storage_entities/loadableby_entities/WildcardLoadableObject.java index 1f87236..3e77627 100644 --- a/src/test/java/test_aids/storage_entities/loadableby_entities/WildcardLoadableObject.java +++ b/src/test/java/test_aids/storage_entities/loadableby_entities/WildcardLoadableObject.java @@ -1,6 +1,6 @@ package test_aids.storage_entities.loadableby_entities; -import component_construction.storable.dynamic_loading.*; +import storage.dynamic_loading.*; public record WildcardLoadableObject(int a) implements LoadableBy> {} From 36c69d1bab2dcd12bd1d83f3e1e89db68c7cb761 Mon Sep 17 00:00:00 2001 From: warburec <77669019+warburec@users.noreply.github.com> Date: Wed, 7 Oct 2026 23:11:03 +0100 Subject: [PATCH 5/6] Removal of unused imports --- src/test/java/storage/dynamic_loading/LoadableByTests.java | 2 -- src/test/java/storage/dynamic_loading/LoaderTests.java | 1 - .../dynamic_loading/ReflectiveClassConstructorTests.java | 1 - 3 files changed, 4 deletions(-) diff --git a/src/test/java/storage/dynamic_loading/LoadableByTests.java b/src/test/java/storage/dynamic_loading/LoadableByTests.java index 162e6d2..12ef034 100644 --- a/src/test/java/storage/dynamic_loading/LoadableByTests.java +++ b/src/test/java/storage/dynamic_loading/LoadableByTests.java @@ -3,8 +3,6 @@ import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; -import storage.dynamic_loading.LoadableBy; -import storage.dynamic_loading.Loader; import storage.exceptions.IncorrectlyFormattedException; import test_aids.storage_entities.loadableby_entities.*; diff --git a/src/test/java/storage/dynamic_loading/LoaderTests.java b/src/test/java/storage/dynamic_loading/LoaderTests.java index 8e86bc8..99a3c51 100644 --- a/src/test/java/storage/dynamic_loading/LoaderTests.java +++ b/src/test/java/storage/dynamic_loading/LoaderTests.java @@ -3,7 +3,6 @@ import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; -import storage.dynamic_loading.Loader; import storage.exceptions.MissingEmptyConstructorException; import test_aids.storage_entities.*; diff --git a/src/test/java/storage/dynamic_loading/ReflectiveClassConstructorTests.java b/src/test/java/storage/dynamic_loading/ReflectiveClassConstructorTests.java index f39ceb5..90bd5ea 100644 --- a/src/test/java/storage/dynamic_loading/ReflectiveClassConstructorTests.java +++ b/src/test/java/storage/dynamic_loading/ReflectiveClassConstructorTests.java @@ -3,7 +3,6 @@ import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; -import storage.dynamic_loading.ReflectiveClassConstructor; import test_aids.storage_entities.*; import test_aids.storage_entities.TestDynamicObject.*; From 6ba5746c1750861d86d39b312e9891251dd7c158 Mon Sep 17 00:00:00 2001 From: warburec <77669019+warburec@users.noreply.github.com> Date: Thu, 8 Oct 2026 00:49:56 +0100 Subject: [PATCH 6/6] Documentation of dynamic_loading helpers --- src/main/java/storage/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/storage/README.md b/src/main/java/storage/README.md index 5fdd6a3..e265bec 100644 --- a/src/main/java/storage/README.md +++ b/src/main/java/storage/README.md @@ -16,6 +16,17 @@ storage.store(someStorable); storage.loadInto(new ExampleLoadable()); ``` +## Additional Features +The [dynamic_loading](/src/main/java/storage/dynamic_loading/) folder holds helpful features to enable dynamic loading of complex objects. + +`Factory` methods may be defined for constructing objects, even if they do not implement `Loadable`. They may be defined as lambdas, making it convenient for users to define and interchange them. + +`Loader` classes can be created which are simply `Factory` implementations for instantiating objects of a specific type. It is expected that `Loader` classes contain an empty constructor so they may be instantiated through reflection. + +Classes may implement `LoadableBy` to explicitly link them to a specific `Loader`. When correctly defined, a `Loader` object may be instantiated through this reference (via reflection) and used to instantiate objects of the original class. + +A class may implement `ReflectivelyLoadable` and a constructor intended for reflective use (see [ReflectiveClassConstructor](/src/main/java/storage/dynamic_loading/ReflectiveClassConstructor.java)). Objects of these classes can be loaded using `ReflectiveClassConstructor`. + ## Diagrams ### Usage Pipeline ![Usage Pipeline Diagram](/docs/diagrams/StorageUsagePipeline.drawio.svg)