class DurationConfig implements ConditionConfig {

   @Override
   public Condition generate(Map<String, Object> values) {
      Preconditions.checkState(matcher != null, "must specify matcher");
      Preconditions.checkState(selector != null, "must specify selector");
      Preconditions.checkState(duration != null, "must specify a duration");
      
      int duration = FunctionFactory.toInteger(this.duration.toTemplate(), values);
      Predicate<Model> matcher = FunctionFactory.toModelPredicate(this.matcher.toTemplate(), values);
      Predicate<Model> selector = FunctionFactory.toModelPredicate(this.selector.toTemplate(), values);
      return new DurationTrigger(new ModelPredicateMatcher(selector, matcher), this.unit.toMillis(duration));
   }

}