forked from Fascinated/Bat
use an enum for feature states
This commit is contained in:
@ -13,6 +13,7 @@ import org.springframework.context.annotation.DependsOn;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -78,4 +79,13 @@ public class FeatureService {
|
||||
public boolean isFeature(@NonNull String name) {
|
||||
return features.containsKey(name.toLowerCase());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the features sorted by name and status
|
||||
*
|
||||
* @return The features sorted
|
||||
*/
|
||||
public List<Feature> getFeaturesSorted() {
|
||||
return features.values().stream().sorted((feature1, feature2) -> feature1.getName().compareToIgnoreCase(feature2.getName())).toList();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user