mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-15 12:59:00 +00:00
📍Use lombok, reformat, and optimize the code (#1560)
* Use lombok, reformat, and optimize the code * Fix merge conflicts and some sonar issues Co-authored-by: va1m <va1m@email.com>
This commit is contained in:
+9
-14
@@ -26,6 +26,7 @@ package com.iluwatar.featuretoggle.pattern.propertiesversion;
|
||||
import com.iluwatar.featuretoggle.pattern.Service;
|
||||
import com.iluwatar.featuretoggle.user.User;
|
||||
import java.util.Properties;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* This example of the Feature Toogle pattern is less dynamic version than {@link
|
||||
@@ -40,9 +41,15 @@ import java.util.Properties;
|
||||
* @see com.iluwatar.featuretoggle.pattern.tieredversion.TieredFeatureToggleVersion
|
||||
* @see User
|
||||
*/
|
||||
@Getter
|
||||
public class PropertiesFeatureToggleVersion implements Service {
|
||||
|
||||
private final boolean isEnhanced;
|
||||
/**
|
||||
* True if the welcome message to be returned is the enhanced venison or not. For
|
||||
* this service it will see the value of the boolean that was set in the constructor {@link
|
||||
* PropertiesFeatureToggleVersion#PropertiesFeatureToggleVersion(Properties)}
|
||||
*/
|
||||
private final boolean enhanced;
|
||||
|
||||
/**
|
||||
* Creates an instance of {@link PropertiesFeatureToggleVersion} using the passed {@link
|
||||
@@ -59,7 +66,7 @@ public class PropertiesFeatureToggleVersion implements Service {
|
||||
throw new IllegalArgumentException("No Properties Provided.");
|
||||
} else {
|
||||
try {
|
||||
isEnhanced = (boolean) properties.get("enhancedWelcome");
|
||||
enhanced = (boolean) properties.get("enhancedWelcome");
|
||||
} catch (Exception e) {
|
||||
throw new IllegalArgumentException("Invalid Enhancement Settings Provided.");
|
||||
}
|
||||
@@ -87,16 +94,4 @@ public class PropertiesFeatureToggleVersion implements Service {
|
||||
|
||||
return "Welcome to the application.";
|
||||
}
|
||||
|
||||
/**
|
||||
* Method that checks if the welcome message to be returned is the enhanced venison or not. For
|
||||
* this service it will see the value of the boolean that was set in the constructor {@link
|
||||
* PropertiesFeatureToggleVersion#PropertiesFeatureToggleVersion(Properties)}
|
||||
*
|
||||
* @return Boolean value {@code true} if enhanced.
|
||||
*/
|
||||
@Override
|
||||
public boolean isEnhanced() {
|
||||
return isEnhanced;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user