diff --git a/src/main/java/me/blvckbytes/bbconfigmapper/ConfigMapper.java b/src/main/java/me/blvckbytes/bbconfigmapper/ConfigMapper.java index 4ff606c..7da2d1f 100644 --- a/src/main/java/me/blvckbytes/bbconfigmapper/ConfigMapper.java +++ b/src/main/java/me/blvckbytes/bbconfigmapper/ConfigMapper.java @@ -29,6 +29,7 @@ import me.blvckbytes.gpeee.GPEEE; import me.blvckbytes.gpeee.IExpressionEvaluator; import me.blvckbytes.gpeee.Tuple; +import me.blvckbytes.gpeee.interpreter.EvaluationEnvironmentBuilder; import org.jetbrains.annotations.Nullable; import java.lang.reflect.*; @@ -69,7 +70,7 @@ public IConfig getConfig() { } @Override - public T mapSection(@Nullable String root, Class type) throws Exception { + public T mapSection(@Nullable String root, Class type) throws Exception { logger.log(Level.FINEST, () -> DebugLogSource.MAPPER + "At the entry point of mapping path=" + root + " to type=" + type); return mapSectionSub(root, null, type); } @@ -86,9 +87,9 @@ public T mapSection(@Nullable String root, Class t * @param type Class of the config section to instantiate * @return Instantiated class with mapped fields */ - private T mapSectionSub(@Nullable String root, @Nullable Map source, Class type) throws Exception { + private T mapSectionSub(@Nullable String root, @Nullable Map source, Class type) throws Exception { logger.log(Level.FINEST, () -> DebugLogSource.MAPPER + "At the subroutine of mapping path=" + root + " to type=" + type + " using source=" + source); - T instance = findDefaultConstructor(type).newInstance(); + T instance = findStandardConstructor(type).newInstance(evaluator.getBaseEnvironment()); Tuple, Iterator> fields = findApplicableFields(type); @@ -245,7 +246,7 @@ private Tuple, Iterator> findApplicableFields(Class type) /** * Tries to convert the input object to the specified type, by either stringifying, - * wrapping the value as an {@link IEvaluable} or by parsing a {@link IConfigSection} + * wrapping the value as an {@link IEvaluable} or by parsing a {@link AConfigSection} * if the input is of type map and returning null otherwise. Unsupported types throw. * @param input Input object to convert * @param type Type to convert to @@ -280,7 +281,7 @@ private Tuple, Iterator> findApplicableFields(Class type) return input; } - if (IConfigSection.class.isAssignableFrom(type)) { + if (AConfigSection.class.isAssignableFrom(type)) { logger.log(Level.FINEST, () -> DebugLogSource.MAPPER + "Parsing value as config-section"); if (!(input instanceof Map)) { @@ -288,7 +289,7 @@ private Tuple, Iterator> findApplicableFields(Class type) input = new HashMap<>(); } - Object value = mapSectionSub(null, (Map) input, type.asSubclass(IConfigSection.class)); + Object value = mapSectionSub(null, (Map) input, type.asSubclass(AConfigSection.class)); if (converter != null) value = converter.apply(value, evaluator); @@ -457,9 +458,9 @@ private Object handleResolveArrayField(Field f, Object value) throws Exception { return null; } - if (IConfigSection.class.isAssignableFrom(type)) { + if (AConfigSection.class.isAssignableFrom(type)) { logger.log(Level.FINEST, () -> DebugLogSource.MAPPER + "Type is of another section"); - return mapSectionSub(path, source, type.asSubclass(IConfigSection.class)); + return mapSectionSub(path, source, type.asSubclass(AConfigSection.class)); } logger.log(Level.FINEST, () -> DebugLogSource.MAPPER + "Resolving path value as plain object"); @@ -505,18 +506,21 @@ private String joinPaths(@Nullable String a, @Nullable String b) { } /** - * Find the default constructor of a class (no parameters required to instantiate it) + * Find the standard constructor of a class: constructor(EvaluationEnvironmentBuilder) * or throw a runtime exception otherwise. * @param type Type of the target class - * @return Default constructor + * @return Standard constructor */ - private Constructor findDefaultConstructor(Class type) { + private Constructor findStandardConstructor(Class type) { try { - Constructor ctor = type.getDeclaredConstructor(); - ctor.setAccessible(true); - return ctor; + Constructor constructor = type.getDeclaredConstructor(EvaluationEnvironmentBuilder.class); + + if (!Modifier.isPublic(constructor.getModifiers())) + throw new IllegalStateException("The standard-constructor of a config-section has to be public"); + + return constructor; } catch (NoSuchMethodException e) { - throw new IllegalStateException("Please specify an empty default constructor on " + type); + throw new IllegalStateException("Please specify a standard-constructor taking an EvaluationEnvironmentBuilder on " + type); } } @@ -541,7 +545,7 @@ private Constructor findDefaultConstructor(Class type) { } /** - * Attempts to unwrap a given type to it's raw type class + * Attempts to unwrap a given type to its raw type class * @param type Type to unwrap * @return Unwrapped type */ diff --git a/src/main/java/me/blvckbytes/bbconfigmapper/ConfigValue.java b/src/main/java/me/blvckbytes/bbconfigmapper/ConfigValue.java index 9192a26..a276f15 100644 --- a/src/main/java/me/blvckbytes/bbconfigmapper/ConfigValue.java +++ b/src/main/java/me/blvckbytes/bbconfigmapper/ConfigValue.java @@ -34,9 +34,9 @@ public class ConfigValue implements IEvaluable { protected final @Nullable Object value; - private final @Nullable IExpressionEvaluator evaluator; + private final IExpressionEvaluator evaluator; - public ConfigValue(@Nullable Object value, @Nullable IExpressionEvaluator evaluator) { + public ConfigValue(@Nullable Object value, IExpressionEvaluator evaluator) { this.value = value; this.evaluator = evaluator; } @@ -61,7 +61,7 @@ public Set asSet(ScalarType type, IEvaluationEnvironment env) { @Override public Object asRawObject(IEvaluationEnvironment env) { - if (value instanceof AExpression && this.evaluator != null) + if (value instanceof AExpression) return this.evaluator.evaluateExpression((AExpression) value, env); return value; } @@ -89,7 +89,7 @@ protected T interpretScalar(@Nullable Object input, ScalarType type, IEva return (T) input; // The input is an expression which needs to be evaluated first - if (input instanceof AExpression && this.evaluator != null) + if (input instanceof AExpression) input = this.evaluator.evaluateExpression((AExpression) input, env); return (T) type.getInterpreter().apply(input, env); @@ -110,7 +110,7 @@ protected T interpretScalar(@Nullable Object input, ScalarType type, IEva @SuppressWarnings("unchecked") private T interpret(@Nullable Object input, Class type, @Nullable ScalarType[] genericTypes, IEvaluationEnvironment env) { - if (input instanceof AExpression && this.evaluator != null) + if (input instanceof AExpression) input = this.evaluator.evaluateExpression((AExpression) input, env); if (type == List.class || type == Set.class) { @@ -139,7 +139,7 @@ private T interpret(@Nullable Object input, Class type, @Nullable ScalarTy // FIXME: This seems hella repetitive to #interpretScalar // Expression result collections are flattened into the return result collection, if applicable - if (item instanceof AExpression && this.evaluator != null) { + if (item instanceof AExpression) { Object result = this.evaluator.evaluateExpression((AExpression) item, env); if (result instanceof Collection) { diff --git a/src/main/java/me/blvckbytes/bbconfigmapper/IConfigMapper.java b/src/main/java/me/blvckbytes/bbconfigmapper/IConfigMapper.java index 0ec1ba2..1da12a1 100644 --- a/src/main/java/me/blvckbytes/bbconfigmapper/IConfigMapper.java +++ b/src/main/java/me/blvckbytes/bbconfigmapper/IConfigMapper.java @@ -24,7 +24,7 @@ package me.blvckbytes.bbconfigmapper; -import me.blvckbytes.bbconfigmapper.sections.IConfigSection; +import me.blvckbytes.bbconfigmapper.sections.AConfigSection; import org.jetbrains.annotations.Nullable; public interface IConfigMapper { @@ -32,12 +32,12 @@ public interface IConfigMapper { /** * Creates an empty instance of the provided type by invoking the default-constructor * and then traverses it's fields to assign them one after the other with available - * configuration values while making use of the decision methods within {@link IConfigSection} + * configuration values while making use of the decision methods within {@link AConfigSection} * @param root Root node of this section (null means config root) * @param type Type of the class to map * @return Mapped instance of specified type */ - T mapSection(@Nullable String root, Class type) throws Exception; + T mapSection(@Nullable String root, Class type) throws Exception; /** * Get the underlying configuration instance diff --git a/src/main/java/me/blvckbytes/bbconfigmapper/sections/IConfigSection.java b/src/main/java/me/blvckbytes/bbconfigmapper/sections/AConfigSection.java similarity index 76% rename from src/main/java/me/blvckbytes/bbconfigmapper/sections/IConfigSection.java rename to src/main/java/me/blvckbytes/bbconfigmapper/sections/AConfigSection.java index 41eebf7..0337078 100644 --- a/src/main/java/me/blvckbytes/bbconfigmapper/sections/IConfigSection.java +++ b/src/main/java/me/blvckbytes/bbconfigmapper/sections/AConfigSection.java @@ -24,12 +24,23 @@ package me.blvckbytes.bbconfigmapper.sections; +import me.blvckbytes.gpeee.interpreter.EvaluationEnvironmentBuilder; import org.jetbrains.annotations.Nullable; import java.lang.reflect.Field; import java.util.List; -public interface IConfigSection { +public abstract class AConfigSection { + + private final EvaluationEnvironmentBuilder baseEnvironment; + + public AConfigSection(EvaluationEnvironmentBuilder baseEnvironment) { + this.baseEnvironment = baseEnvironment; + } + + public EvaluationEnvironmentBuilder getBaseEnvironment() { + return baseEnvironment.duplicate(); + } /** * Called to decide the type of Object fields at runtime, @@ -40,14 +51,16 @@ public interface IConfigSection { * @param field Target field in question * @return Decided type, Object.class means skip */ - default @Nullable Class runtimeDecide(String field) { return null; } + public @Nullable Class runtimeDecide(String field) { + return null; + } /** * Called when a field wasn't found within the config and a default could be set * @param field Target field * @return Value to use as a default */ - default @Nullable Object defaultFor(Field field) throws Exception { + public @Nullable Object defaultFor(Field field) throws Exception { return null; } @@ -55,6 +68,6 @@ public interface IConfigSection { * Called when parsing of the section is completed * and no more changes will be applied */ - default void afterParsing(List fields) throws Exception {} + public void afterParsing(List fields) throws Exception {} } diff --git a/src/test/java/me/blvckbytes/bbconfigmapper/ConfigMapperTests.java b/src/test/java/me/blvckbytes/bbconfigmapper/ConfigMapperTests.java index cbdc84c..84ac8aa 100644 --- a/src/test/java/me/blvckbytes/bbconfigmapper/ConfigMapperTests.java +++ b/src/test/java/me/blvckbytes/bbconfigmapper/ConfigMapperTests.java @@ -293,9 +293,9 @@ public void shouldThrowWhenSectionSelfReferences() throws Exception { } @Test - public void shouldThrowWhenNoDefaultConstructorAvailable() throws Exception { + public void shouldThrowWhenNoStandardConstructorAvailable() throws Exception { IConfigMapper mapper = helper.makeMapper("mappings.yml"); - helper.assertThrowsWithMsg(IllegalStateException.class, () -> mapper.mapSection(null, NoDefaultConstructorSection.class), "Please specify an empty default constructor"); + helper.assertThrowsWithMsg(IllegalStateException.class, () -> mapper.mapSection(null, NoStandardConstructorSection.class), "Please specify a standard-constructor taking an EvaluationEnvironmentBuilder on "); } @Test diff --git a/src/test/java/me/blvckbytes/bbconfigmapper/sections/BlockBreakQuestParameterSection.java b/src/test/java/me/blvckbytes/bbconfigmapper/sections/BlockBreakQuestParameterSection.java index a9a8312..cd8f8dd 100644 --- a/src/test/java/me/blvckbytes/bbconfigmapper/sections/BlockBreakQuestParameterSection.java +++ b/src/test/java/me/blvckbytes/bbconfigmapper/sections/BlockBreakQuestParameterSection.java @@ -24,14 +24,20 @@ package me.blvckbytes.bbconfigmapper.sections; +import me.blvckbytes.gpeee.interpreter.EvaluationEnvironmentBuilder; + import java.lang.reflect.Field; import java.util.List; -public class BlockBreakQuestParameterSection implements IConfigSection { +public class BlockBreakQuestParameterSection extends AConfigSection { private String material; private String world; + public BlockBreakQuestParameterSection(EvaluationEnvironmentBuilder baseEnvironment) { + super(baseEnvironment); + } + @Override public Class runtimeDecide(String field) { return null; diff --git a/src/test/java/me/blvckbytes/bbconfigmapper/sections/CustomEnumSection.java b/src/test/java/me/blvckbytes/bbconfigmapper/sections/CustomEnumSection.java index a6e3d3c..93fcaaf 100644 --- a/src/test/java/me/blvckbytes/bbconfigmapper/sections/CustomEnumSection.java +++ b/src/test/java/me/blvckbytes/bbconfigmapper/sections/CustomEnumSection.java @@ -24,13 +24,19 @@ package me.blvckbytes.bbconfigmapper.sections; -public class CustomEnumSection implements IConfigSection { +import me.blvckbytes.gpeee.interpreter.EvaluationEnvironmentBuilder; + +public class CustomEnumSection extends AConfigSection { private ECustomEnum customEnumA; private ECustomEnum customEnumB; private ECustomEnum customEnumC; private ECustomEnum customEnumInvalid; + public CustomEnumSection(EvaluationEnvironmentBuilder baseEnvironment) { + super(baseEnvironment); + } + public ECustomEnum getCustomEnumA() { return customEnumA; } diff --git a/src/test/java/me/blvckbytes/bbconfigmapper/sections/DatabaseSectionEvaluables.java b/src/test/java/me/blvckbytes/bbconfigmapper/sections/DatabaseSectionEvaluables.java index d970cc7..064ca41 100644 --- a/src/test/java/me/blvckbytes/bbconfigmapper/sections/DatabaseSectionEvaluables.java +++ b/src/test/java/me/blvckbytes/bbconfigmapper/sections/DatabaseSectionEvaluables.java @@ -25,14 +25,19 @@ package me.blvckbytes.bbconfigmapper.sections; import me.blvckbytes.bbconfigmapper.IEvaluable; +import me.blvckbytes.gpeee.interpreter.EvaluationEnvironmentBuilder; import java.lang.reflect.Field; import java.util.List; -public class DatabaseSectionEvaluables implements IConfigSection { +public class DatabaseSectionEvaluables extends AConfigSection { private IEvaluable host, port, database, username, password; + public DatabaseSectionEvaluables(EvaluationEnvironmentBuilder baseEnvironment) { + super(baseEnvironment); + } + @Override public Class runtimeDecide(String field) { return null; diff --git a/src/test/java/me/blvckbytes/bbconfigmapper/sections/DatabaseSectionStrings.java b/src/test/java/me/blvckbytes/bbconfigmapper/sections/DatabaseSectionStrings.java index bd8771c..25e86d1 100644 --- a/src/test/java/me/blvckbytes/bbconfigmapper/sections/DatabaseSectionStrings.java +++ b/src/test/java/me/blvckbytes/bbconfigmapper/sections/DatabaseSectionStrings.java @@ -24,15 +24,20 @@ package me.blvckbytes.bbconfigmapper.sections; +import me.blvckbytes.gpeee.interpreter.EvaluationEnvironmentBuilder; import org.jetbrains.annotations.Nullable; import java.lang.reflect.Field; import java.util.List; -public class DatabaseSectionStrings implements IConfigSection { +public class DatabaseSectionStrings extends AConfigSection { private String host, port, database, username, password; + public DatabaseSectionStrings(EvaluationEnvironmentBuilder baseEnvironment) { + super(baseEnvironment); + } + @Override public Class runtimeDecide(String field) { return null; diff --git a/src/test/java/me/blvckbytes/bbconfigmapper/sections/EntityKillQuestParameterSection.java b/src/test/java/me/blvckbytes/bbconfigmapper/sections/EntityKillQuestParameterSection.java index 7099a54..86489a4 100644 --- a/src/test/java/me/blvckbytes/bbconfigmapper/sections/EntityKillQuestParameterSection.java +++ b/src/test/java/me/blvckbytes/bbconfigmapper/sections/EntityKillQuestParameterSection.java @@ -24,14 +24,20 @@ package me.blvckbytes.bbconfigmapper.sections; +import me.blvckbytes.gpeee.interpreter.EvaluationEnvironmentBuilder; + import java.lang.reflect.Field; import java.util.List; -public class EntityKillQuestParameterSection implements IConfigSection { +public class EntityKillQuestParameterSection extends AConfigSection { private String entityType; private String entityName; + public EntityKillQuestParameterSection(EvaluationEnvironmentBuilder baseEnvironment) { + super(baseEnvironment); + } + @Override public Class runtimeDecide(String field) { return null; diff --git a/src/test/java/me/blvckbytes/bbconfigmapper/sections/IgnoreSection.java b/src/test/java/me/blvckbytes/bbconfigmapper/sections/IgnoreSection.java index 1f69200..08daa38 100644 --- a/src/test/java/me/blvckbytes/bbconfigmapper/sections/IgnoreSection.java +++ b/src/test/java/me/blvckbytes/bbconfigmapper/sections/IgnoreSection.java @@ -24,10 +24,12 @@ package me.blvckbytes.bbconfigmapper.sections; +import me.blvckbytes.gpeee.interpreter.EvaluationEnvironmentBuilder; + import java.lang.reflect.Field; import java.util.List; -public class IgnoreSection implements IConfigSection { +public class IgnoreSection extends AConfigSection { @CSIgnore private String ignored1; @@ -39,6 +41,10 @@ public class IgnoreSection implements IConfigSection { private static String ignored4; + public IgnoreSection(EvaluationEnvironmentBuilder baseEnvironment) { + super(baseEnvironment); + } + @Override public Class runtimeDecide(String field) { return null; diff --git a/src/test/java/me/blvckbytes/bbconfigmapper/sections/NoDefaultConstructorSection.java b/src/test/java/me/blvckbytes/bbconfigmapper/sections/NoStandardConstructorSection.java similarity index 90% rename from src/test/java/me/blvckbytes/bbconfigmapper/sections/NoDefaultConstructorSection.java rename to src/test/java/me/blvckbytes/bbconfigmapper/sections/NoStandardConstructorSection.java index ac6891a..f466c7f 100644 --- a/src/test/java/me/blvckbytes/bbconfigmapper/sections/NoDefaultConstructorSection.java +++ b/src/test/java/me/blvckbytes/bbconfigmapper/sections/NoStandardConstructorSection.java @@ -27,11 +27,12 @@ import java.lang.reflect.Field; import java.util.List; -public class NoDefaultConstructorSection implements IConfigSection { +public class NoStandardConstructorSection extends AConfigSection { private String a, b, c; - public NoDefaultConstructorSection(String a, String b, String c) { + public NoStandardConstructorSection(String a, String b, String c) { + super(null); this.a = a; this.b = b; this.c = c; diff --git a/src/test/java/me/blvckbytes/bbconfigmapper/sections/PotionArraySection.java b/src/test/java/me/blvckbytes/bbconfigmapper/sections/PotionArraySection.java index d727dc1..9c66c8d 100644 --- a/src/test/java/me/blvckbytes/bbconfigmapper/sections/PotionArraySection.java +++ b/src/test/java/me/blvckbytes/bbconfigmapper/sections/PotionArraySection.java @@ -24,15 +24,21 @@ package me.blvckbytes.bbconfigmapper.sections; +import me.blvckbytes.gpeee.interpreter.EvaluationEnvironmentBuilder; + import java.lang.reflect.Field; import java.util.List; -public class PotionArraySection implements IConfigSection { +public class PotionArraySection extends AConfigSection { private String type; private PotionEffectSection[] effects; + public PotionArraySection(EvaluationEnvironmentBuilder baseEnvironment) { + super(baseEnvironment); + } + @Override public Class runtimeDecide(String field) { return null; diff --git a/src/test/java/me/blvckbytes/bbconfigmapper/sections/PotionArraySectionAlways.java b/src/test/java/me/blvckbytes/bbconfigmapper/sections/PotionArraySectionAlways.java index 46813e7..3dddbb0 100644 --- a/src/test/java/me/blvckbytes/bbconfigmapper/sections/PotionArraySectionAlways.java +++ b/src/test/java/me/blvckbytes/bbconfigmapper/sections/PotionArraySectionAlways.java @@ -24,16 +24,22 @@ package me.blvckbytes.bbconfigmapper.sections; +import me.blvckbytes.gpeee.interpreter.EvaluationEnvironmentBuilder; + import java.lang.reflect.Field; import java.util.List; -public class PotionArraySectionAlways implements IConfigSection { +public class PotionArraySectionAlways extends AConfigSection { private String type; @CSAlways private PotionEffectSection[] effects; + public PotionArraySectionAlways(EvaluationEnvironmentBuilder baseEnvironment) { + super(baseEnvironment); + } + @Override public Class runtimeDecide(String field) { return null; diff --git a/src/test/java/me/blvckbytes/bbconfigmapper/sections/PotionEffectSection.java b/src/test/java/me/blvckbytes/bbconfigmapper/sections/PotionEffectSection.java index d047945..f63cc2c 100644 --- a/src/test/java/me/blvckbytes/bbconfigmapper/sections/PotionEffectSection.java +++ b/src/test/java/me/blvckbytes/bbconfigmapper/sections/PotionEffectSection.java @@ -25,13 +25,19 @@ package me.blvckbytes.bbconfigmapper.sections; +import me.blvckbytes.gpeee.interpreter.EvaluationEnvironmentBuilder; + import java.lang.reflect.Field; import java.util.List; -public class PotionEffectSection implements IConfigSection { +public class PotionEffectSection extends AConfigSection { private String effect, duration, amplifier; + public PotionEffectSection(EvaluationEnvironmentBuilder baseEnvironment) { + super(baseEnvironment); + } + @Override public Class runtimeDecide(String field) { return null; diff --git a/src/test/java/me/blvckbytes/bbconfigmapper/sections/PotionListSection.java b/src/test/java/me/blvckbytes/bbconfigmapper/sections/PotionListSection.java index e8ef467..a1dfa2d 100644 --- a/src/test/java/me/blvckbytes/bbconfigmapper/sections/PotionListSection.java +++ b/src/test/java/me/blvckbytes/bbconfigmapper/sections/PotionListSection.java @@ -24,14 +24,20 @@ package me.blvckbytes.bbconfigmapper.sections; +import me.blvckbytes.gpeee.interpreter.EvaluationEnvironmentBuilder; + import java.lang.reflect.Field; import java.util.List; -public class PotionListSection implements IConfigSection { +public class PotionListSection extends AConfigSection { private String type; private List effects; + public PotionListSection(EvaluationEnvironmentBuilder baseEnvironment) { + super(baseEnvironment); + } + @Override public Class runtimeDecide(String field) { return null; diff --git a/src/test/java/me/blvckbytes/bbconfigmapper/sections/PotionListSectionAlways.java b/src/test/java/me/blvckbytes/bbconfigmapper/sections/PotionListSectionAlways.java index 66f6162..5787459 100644 --- a/src/test/java/me/blvckbytes/bbconfigmapper/sections/PotionListSectionAlways.java +++ b/src/test/java/me/blvckbytes/bbconfigmapper/sections/PotionListSectionAlways.java @@ -24,16 +24,22 @@ package me.blvckbytes.bbconfigmapper.sections; +import me.blvckbytes.gpeee.interpreter.EvaluationEnvironmentBuilder; + import java.lang.reflect.Field; import java.util.List; -public class PotionListSectionAlways implements IConfigSection { +public class PotionListSectionAlways extends AConfigSection { private String type; @CSAlways private List effects; + public PotionListSectionAlways(EvaluationEnvironmentBuilder baseEnvironment) { + super(baseEnvironment); + } + @Override public Class runtimeDecide(String field) { return null; diff --git a/src/test/java/me/blvckbytes/bbconfigmapper/sections/PotionSimpleSection.java b/src/test/java/me/blvckbytes/bbconfigmapper/sections/PotionSimpleSection.java index b96d847..7df0ff5 100644 --- a/src/test/java/me/blvckbytes/bbconfigmapper/sections/PotionSimpleSection.java +++ b/src/test/java/me/blvckbytes/bbconfigmapper/sections/PotionSimpleSection.java @@ -24,14 +24,20 @@ package me.blvckbytes.bbconfigmapper.sections; +import me.blvckbytes.gpeee.interpreter.EvaluationEnvironmentBuilder; + import java.lang.reflect.Field; import java.util.List; -public class PotionSimpleSection implements IConfigSection { +public class PotionSimpleSection extends AConfigSection { private String type; private PotionEffectSection mainEffect; + public PotionSimpleSection(EvaluationEnvironmentBuilder baseEnvironment) { + super(baseEnvironment); + } + @Override public Class runtimeDecide(String field) { return null; diff --git a/src/test/java/me/blvckbytes/bbconfigmapper/sections/PotionSimpleSectionAlways.java b/src/test/java/me/blvckbytes/bbconfigmapper/sections/PotionSimpleSectionAlways.java index fe7bb8b..2d44948 100644 --- a/src/test/java/me/blvckbytes/bbconfigmapper/sections/PotionSimpleSectionAlways.java +++ b/src/test/java/me/blvckbytes/bbconfigmapper/sections/PotionSimpleSectionAlways.java @@ -24,16 +24,22 @@ package me.blvckbytes.bbconfigmapper.sections; +import me.blvckbytes.gpeee.interpreter.EvaluationEnvironmentBuilder; + import java.lang.reflect.Field; import java.util.List; -public class PotionSimpleSectionAlways implements IConfigSection { +public class PotionSimpleSectionAlways extends AConfigSection { private String type; @CSAlways private PotionEffectSection mainEffect; + public PotionSimpleSectionAlways(EvaluationEnvironmentBuilder baseEnvironment) { + super(baseEnvironment); + } + @Override public Class runtimeDecide(String field) { return null; diff --git a/src/test/java/me/blvckbytes/bbconfigmapper/sections/QuestSection.java b/src/test/java/me/blvckbytes/bbconfigmapper/sections/QuestSection.java index 7958fa5..a15d985 100644 --- a/src/test/java/me/blvckbytes/bbconfigmapper/sections/QuestSection.java +++ b/src/test/java/me/blvckbytes/bbconfigmapper/sections/QuestSection.java @@ -24,16 +24,19 @@ package me.blvckbytes.bbconfigmapper.sections; -import java.lang.reflect.Field; -import java.util.List; +import me.blvckbytes.gpeee.interpreter.EvaluationEnvironmentBuilder; -public class QuestSection implements IConfigSection { +public class QuestSection extends AConfigSection { private String type; @CSInlined private Object parameter; + public QuestSection(EvaluationEnvironmentBuilder baseEnvironment) { + super(baseEnvironment); + } + @Override public Class runtimeDecide(String field) { if (field.equals("parameter")) { diff --git a/src/test/java/me/blvckbytes/bbconfigmapper/sections/SelfRefSection.java b/src/test/java/me/blvckbytes/bbconfigmapper/sections/SelfRefSection.java index ee253dc..4d70e60 100644 --- a/src/test/java/me/blvckbytes/bbconfigmapper/sections/SelfRefSection.java +++ b/src/test/java/me/blvckbytes/bbconfigmapper/sections/SelfRefSection.java @@ -24,13 +24,19 @@ package me.blvckbytes.bbconfigmapper.sections; +import me.blvckbytes.gpeee.interpreter.EvaluationEnvironmentBuilder; + import java.lang.reflect.Field; import java.util.List; -public class SelfRefSection implements IConfigSection { +public class SelfRefSection extends AConfigSection { private SelfRefSection self; + public SelfRefSection(EvaluationEnvironmentBuilder baseEnvironment) { + super(baseEnvironment); + } + @Override public Class runtimeDecide(String field) { return null; diff --git a/src/test/java/me/blvckbytes/bbconfigmapper/sections/UiLayoutSection.java b/src/test/java/me/blvckbytes/bbconfigmapper/sections/UiLayoutSection.java index d8534be..ef1bfba 100644 --- a/src/test/java/me/blvckbytes/bbconfigmapper/sections/UiLayoutSection.java +++ b/src/test/java/me/blvckbytes/bbconfigmapper/sections/UiLayoutSection.java @@ -25,16 +25,21 @@ package me.blvckbytes.bbconfigmapper.sections; import me.blvckbytes.bbconfigmapper.IEvaluable; +import me.blvckbytes.gpeee.interpreter.EvaluationEnvironmentBuilder; import java.lang.reflect.Field; import java.util.List; import java.util.Map; -public class UiLayoutSection implements IConfigSection { +public class UiLayoutSection extends AConfigSection { private String uiName; private Map layout; + public UiLayoutSection(EvaluationEnvironmentBuilder baseEnvironment) { + super(baseEnvironment); + } + @Override public Class runtimeDecide(String field) { return null; diff --git a/src/test/java/me/blvckbytes/bbconfigmapper/sections/UiLayoutSectionAlways.java b/src/test/java/me/blvckbytes/bbconfigmapper/sections/UiLayoutSectionAlways.java index e352efa..7ee6d40 100644 --- a/src/test/java/me/blvckbytes/bbconfigmapper/sections/UiLayoutSectionAlways.java +++ b/src/test/java/me/blvckbytes/bbconfigmapper/sections/UiLayoutSectionAlways.java @@ -25,18 +25,23 @@ package me.blvckbytes.bbconfigmapper.sections; import me.blvckbytes.bbconfigmapper.IEvaluable; +import me.blvckbytes.gpeee.interpreter.EvaluationEnvironmentBuilder; import java.lang.reflect.Field; import java.util.List; import java.util.Map; -public class UiLayoutSectionAlways implements IConfigSection { +public class UiLayoutSectionAlways extends AConfigSection { private String uiName; @CSAlways private Map layout; + public UiLayoutSectionAlways(EvaluationEnvironmentBuilder baseEnvironment) { + super(baseEnvironment); + } + @Override public Class runtimeDecide(String field) { return null;