@Override
  public boolean isActive(FeatureState state, FeatureUser user) {

    if (user != null && Strings.isNotBlank(user.getName())) {

      String percentageAsString = state.getParameter(PARAM_PERCENTAGE);
      try {

        int percentage = Integer.valueOf(percentageAsString);

        if (percentage > 0) {
          int hashCode = Math.abs(calculateHashCode(user, state.getFeature()));
          return (hashCode % 100) < percentage;
        }

      } catch (NumberFormatException e) {
        log.error(
            "Invalid gradual rollout percentage for feature "
                + state.getFeature().name()
                + ": "
                + percentageAsString);
      }
    }

    return false;
  }
  @Override
  public int doStartTag() throws JspException {
    boolean inverse = false;
    if (name.startsWith("!")) {
      inverse = true;
      name = name.substring(1);
    }

    boolean isActive = isFeatureActive();

    if (inverse) {
      isActive = !isActive;
    }

    if (Strings.isNotBlank(var)) {
      pageContext.setAttribute(var, isActive, PageContext.PAGE_SCOPE);
    }

    return isActive ? Tag.EVAL_BODY_INCLUDE : Tag.SKIP_BODY;
  }
 protected boolean isFeatureActive() {
   if (Strings.isNotBlank(name)) {
     return featureManager.isActive(new NamedFeature(name));
   }
   return false;
 }
 @Override
 public boolean isValid(String value) {
   return Strings.isNotBlank(value) && languages.contains(value);
 }
 @Override
 public String getDescription() {
   return "The script language to use. Your system seems to support the following languages: "
       + Strings.join(languages, ", ");
 }