/*
- * Copyright (C) 2016, 2017 Roland Häder
+ * Copyright (C) 2016 - 2024 Free Software Foundation
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
*/
package org.mxchange.addressbook.beans.features;
-import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Named;
-import org.mxchange.addressbook.beans.BaseAddressbookController;
+import org.mxchange.addressbook.beans.BaseAddressbookBean;
/**
* A feature bean
*/
@Named ("featureController")
@ApplicationScoped
-public class AddressbookFeatureWebApplicationBean extends BaseAddressbookController implements AddressbookFeaturesWebApplicationController {
+public class AddressbookFeatureWebApplicationBean extends BaseAddressbookBean implements AddressbookFeaturesWebApplicationController {
/**
* Serial number
super();
}
- /**
- * Post-construction method
- */
- @PostConstruct
- public void init () {
- }
-
@Override
public boolean isFeatureEnabled (final String feature) {
// The parameter must be set
throw new IllegalArgumentException("feature is empty"); //NOI18N
}
- // Default is not enabled
- boolean isEnabled = false;
-
- // Try it as an NPE may come
- try {
- // Get value from property
- String value = this.getStringContextParameter(String.format("is_feature_%s_enabled", feature)); //NOI18N
+ // Get value from property
+ final String contextParameter = this.getStringContextParameter(String.format("is_feature_%s_enabled", feature)); //NOI18N
- // Is it set?
- isEnabled = (value.toLowerCase().equals("true")); //NOI18N
- } catch (final NullPointerException ex) {
- // Ignored
- }
+ // Default is not enabled
+ final boolean isEnabled = Boolean.parseBoolean(contextParameter);
- // Return value
+ // Return status
return isEnabled;
}