diff --git a/bot-context/pom.xml b/bot-context/pom.xml index 34d02fa..ca43f67 100644 --- a/bot-context/pom.xml +++ b/bot-context/pom.xml @@ -6,7 +6,7 @@ dev.struchkov.godfather godfather-bot - 0.0.10 + 0.0.11 bot-context diff --git a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/UnitDefinition.java b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/UnitDefinition.java index e933d3d..a361bbc 100644 --- a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/UnitDefinition.java +++ b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/UnitDefinition.java @@ -12,7 +12,6 @@ public class UnitDefinition { private String name; private Object objectConfig; private Method method; - private boolean lazy; public String getName() { return name; @@ -66,12 +65,4 @@ public class UnitDefinition { this.dependentUnits.addAll(dependentUnitNames); } - public boolean isLazy() { - return lazy; - } - - public void setLazy(boolean lazy) { - this.lazy = lazy; - } - } diff --git a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/annotation/Unit.java b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/annotation/Unit.java index 06dcc80..3a1143b 100644 --- a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/annotation/Unit.java +++ b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/annotation/Unit.java @@ -13,8 +13,6 @@ public @interface Unit { String value() default ""; - boolean lazy() default false; - boolean mainUnit() default false; } diff --git a/bot-core/pom.xml b/bot-core/pom.xml index 4e919e4..6cb70bb 100644 --- a/bot-core/pom.xml +++ b/bot-core/pom.xml @@ -6,7 +6,7 @@ dev.struchkov.godfather godfather-bot - 0.0.10 + 0.0.11 bot-core diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/StorylineMaker.java b/bot-core/src/main/java/dev/struchkov/godfather/core/StorylineMaker.java index d35afb8..b0b59ef 100644 --- a/bot-core/src/main/java/dev/struchkov/godfather/core/StorylineMaker.java +++ b/bot-core/src/main/java/dev/struchkov/godfather/core/StorylineMaker.java @@ -31,7 +31,6 @@ public class StorylineMaker { private final Map unitDefinitions = new HashMap<>(); private final Map unitMap = new HashMap<>(); - private final Set lazyUnits = new HashSet<>(); private final Set mainUnits = new HashSet<>(); public StorylineMaker(List unitConfigurations) { @@ -50,7 +49,6 @@ public class StorylineMaker { generateUnitDefinitions(); try { createUnitMap(); - createLazy(); final Set mainUnit = getMainUnit(); return new Storyline(mainUnit, unitMap); } catch (IllegalAccessException | InvocationTargetException e) { @@ -66,43 +64,18 @@ public class StorylineMaker { .collect(Collectors.toSet()); } - private void createLazy() throws IllegalAccessException, InvocationTargetException { - final List lazyDefinitions = unitDefinitions.values().stream() - .filter(UnitDefinition::isLazy) - .toList(); - for (UnitDefinition lazyDefinition : lazyDefinitions) { - final MainUnit lazyUnit = createUnit(lazyDefinition); - unitMap.put(lazyDefinition.getName(), lazyUnit); - for (String dependentUnit : lazyDefinition.getDependentUnits()) { - final MainUnit mainUnit = unitMap.get(dependentUnit); - final Set nextUnits = mainUnit.getNextUnits(); - if (nextUnits != null) { - nextUnits.add(lazyUnit); - } - } - } - } - private void createUnitMap() throws IllegalAccessException, InvocationTargetException { for (UnitDefinition unitDefinition : unitDefinitions.values()) { if (!unitMap.containsKey(unitDefinition.getName())) { final Set nextUnitNames = unitDefinition.getNextUnitNames(); if (nextUnitNames.isEmpty() || unitMap.keySet().containsAll(nextUnitNames)) { createUnit(unitDefinition); - } else if (unitDefinition.isLazy()) { - createLazyUnit(unitDefinition); } } } } - private void createLazyUnit(UnitDefinition unitDefinition) { - final String unitName = unitDefinition.getName(); - unitMap.put(unitName, LazyUnit.create(unitName, unitDefinition)); - } - private MainUnit createUnit(UnitDefinition unitDefinition) throws IllegalAccessException, InvocationTargetException { - final Object objectConfig = unitDefinition.getObjectConfig(); final String currentUnitName = unitDefinition.getName(); final Method method = unitDefinition.getMethod(); @@ -118,7 +91,6 @@ public class StorylineMaker { unitMap.put(currentUnitName, newUnit); final Set dependentUnitsName = unitDefinition.getDependentUnits(); - dependentUnitsName.removeAll(lazyUnits); for (String dependentUnitName : dependentUnitsName) { final Set dependentNextUnitNames = unitDefinitions.get(dependentUnitName).getNextUnitNames(); if (unitMap.keySet().containsAll(dependentNextUnitNames)) { @@ -145,11 +117,7 @@ public class StorylineMaker { unitDefinition.setName(unitName); unitDefinition.setMethod(method); unitDefinition.setObjectConfig(config); - unitDefinition.setLazy(unitConfig.lazy()); - if (unitConfig.lazy()) { - lazyUnits.add(unitName); - } if (unitConfig.mainUnit()) { mainUnits.add(unitName); } diff --git a/pom.xml b/pom.xml index bf9c914..4ff8941 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ dev.struchkov.godfather godfather-bot - 0.0.10 + 0.0.11 pom @@ -32,7 +32,7 @@ UTF-8 UTF-8 - 0.0.10 + 0.0.11 ${godfather.ver} ${godfather.ver}