public Rule build() { Preconditions.checkState(id.isPresent(), "`id` is mandatory"); Preconditions.checkState(name.isPresent(), "`name` is mandatory"); Preconditions.checkState(condition.isPresent(), "`condition` is mandatory"); Preconditions.checkState(action.isPresent(), "`action` is mandatory"); return new Rule(id.get(), name.get(), condition.get(), action.get()); }