mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-04-15 20:16:34 +00:00
moved post targets to an enum, in order to have more type safety, this might be changed in the future
added validation check when a feature is enabled, in order to notify which configuration is missing for this feature to function properly
This commit is contained in:
@@ -2,8 +2,13 @@ package dev.sheldan.abstracto.utility.config.features;
|
||||
|
||||
import dev.sheldan.abstracto.core.config.FeatureEnum;
|
||||
import dev.sheldan.abstracto.core.config.FeatureConfig;
|
||||
import dev.sheldan.abstracto.core.config.PostTargetEnum;
|
||||
import dev.sheldan.abstracto.utility.config.posttargets.StarboardPostTarget;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class StarboardFeature implements FeatureConfig {
|
||||
|
||||
@@ -12,4 +17,8 @@ public class StarboardFeature implements FeatureConfig {
|
||||
return UtilityFeature.STARBOARD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PostTargetEnum> getRequiredPostTargets() {
|
||||
return Arrays.asList(StarboardPostTarget.STARBOARD);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,13 @@ package dev.sheldan.abstracto.utility.config.features;
|
||||
|
||||
import dev.sheldan.abstracto.core.config.FeatureConfig;
|
||||
import dev.sheldan.abstracto.core.config.FeatureEnum;
|
||||
import dev.sheldan.abstracto.core.config.PostTargetEnum;
|
||||
import dev.sheldan.abstracto.utility.config.posttargets.SuggestionPostTarget;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class SuggestionFeature implements FeatureConfig {
|
||||
|
||||
@@ -12,4 +17,8 @@ public class SuggestionFeature implements FeatureConfig {
|
||||
return UtilityFeature.SUGGEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PostTargetEnum> getRequiredPostTargets() {
|
||||
return Arrays.asList(SuggestionPostTarget.SUGGESTION);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package dev.sheldan.abstracto.utility.config.posttargets;
|
||||
|
||||
import dev.sheldan.abstracto.core.config.PostTargetEnum;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum StarboardPostTarget implements PostTargetEnum {
|
||||
STARBOARD("starboard");
|
||||
|
||||
private String key;
|
||||
|
||||
StarboardPostTarget(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package dev.sheldan.abstracto.utility.config.posttargets;
|
||||
|
||||
import dev.sheldan.abstracto.core.config.PostTargetEnum;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum SuggestionPostTarget implements PostTargetEnum {
|
||||
SUGGESTION("suggestions");
|
||||
|
||||
private String key;
|
||||
|
||||
SuggestionPostTarget(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user