From 7f0dc2f6d35f6f389dbd0f7453c0decf725db83e Mon Sep 17 00:00:00 2001 From: Florian CUNY Date: Mon, 6 Aug 2018 15:59:06 +0200 Subject: [PATCH] Prepared handling of the other ConfigEntry fields for Config loading --- .../database/flatfile/FlatFileDatabaseHandler.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/world/bentobox/bentobox/database/flatfile/FlatFileDatabaseHandler.java b/src/main/java/world/bentobox/bentobox/database/flatfile/FlatFileDatabaseHandler.java index fc417ffa2..b05074c2d 100644 --- a/src/main/java/world/bentobox/bentobox/database/flatfile/FlatFileDatabaseHandler.java +++ b/src/main/java/world/bentobox/bentobox/database/flatfile/FlatFileDatabaseHandler.java @@ -101,7 +101,6 @@ public class FlatFileDatabaseHandler extends AbstractDatabaseHandler { } /** - * * Creates a list of s filled with values from the provided ResultSet * * @param config - YAML config file @@ -117,12 +116,19 @@ public class FlatFileDatabaseHandler extends AbstractDatabaseHandler { PropertyDescriptor propertyDescriptor = new PropertyDescriptor(field.getName(), dataObject); // Get the write method Method method = propertyDescriptor.getWriteMethod(); + + // Information about the field String storageLocation = field.getName(); + boolean overrideOnChange, experimental, needsReset = false; + // Check if there is an annotation on the field ConfigEntry configEntry = field.getAnnotation(ConfigEntry.class); // If there is a config annotation then do something if (configEntry != null && !configEntry.path().isEmpty()) { storageLocation = configEntry.path(); + overrideOnChange = configEntry.overrideOnChange(); + experimental = configEntry.experimental(); + needsReset = configEntry.needsReset(); } Adapter adapterNotation = field.getAnnotation(Adapter.class); if (adapterNotation != null && AdapterInterface.class.isAssignableFrom(adapterNotation.value())) { @@ -488,6 +494,5 @@ public class FlatFileDatabaseHandler extends AbstractDatabaseHandler { @Override public void close() { // Not used - } }