@Test public void pojoWithNoThenAnnotationDefaultsToNext() throws InvalidClassException { SampleRuleWithoutAnnotations sampleRule = new SampleRuleWithoutAnnotations(); RuleAdapter ruleAdapter = new RuleAdapter(sampleRule); Assert.assertEquals(0, ((List<Object>)ruleAdapter.getThen()).size()); }
@Override public List<Object> getThen() { if ((_rule.getThen()).size() < 1) { List<Object> thenList = new ArrayList<>(); for (Method thenMethod : getAnnotatedMethods(Then.class, _rulePojo.getClass())) { thenMethod.setAccessible(true); Object then = getThenMethodAsBiConsumer(thenMethod).map(Object.class::cast) .orElse(getThenMethodAsConsumer(thenMethod).orElse(factMap -> { })); thenList.add(then); } (_rule.getThen()).addAll(thenList); } return _rule.getThen(); }
RuleAdapter implements Decision { @Override public List<Object> getThen() { if ((_rule.getThen()).size() < 1) { List<Object> thenList = new ArrayList<>(); for (Method thenMethod : getAnnotatedMethods(Then.class, _rulePojo.getClass())) { thenMethod.setAccessible(true); Object then = getThenMethodAsBiConsumer(thenMethod).map(Object.class::cast) .orElse(getThenMethodAsConsumer(thenMethod).orElse(factMap -> { })); thenList.add(then); } (_rule.getThen()).addAll(thenList); } return _rule.getThen(); } }
RuleAdapter implements Decision { @Override public List<Object> getThen() { if ((_rule.getThen()).size() < 1) { List<Object> thenList = new ArrayList<>(); for (Method thenMethod : getAnnotatedMethods(Then.class, _rulePojo.getClass())) { thenMethod.setAccessible(true); Object then = getThenMethodAsBiConsumer(thenMethod).map(Object.class::cast) .orElse(getThenMethodAsConsumer(thenMethod).orElse(factMap -> { })); thenList.add(then); } (_rule.getThen()).addAll(thenList); } return _rule.getThen(); } @SuppressWarnings("unchecked")  RuleAdapter(Object rulePojo, Rule rule); @SuppressWarnings("unchecked")  RuleAdapter(Object rulePojo); }
RuleAdapter implements Decision { @Override public List<Object> getThen() { if ((_rule.getThen()).size() < 1) { List<Object> thenList = new ArrayList<>(); for (Method thenMethod : getAnnotatedMethods(Then.class, _rulePojo.getClass())) { thenMethod.setAccessible(true); Object then = getThenMethodAsBiConsumer(thenMethod).map(Object.class::cast) .orElse(getThenMethodAsConsumer(thenMethod).orElse(factMap -> { })); thenList.add(then); } (_rule.getThen()).addAll(thenList); } return _rule.getThen(); } @SuppressWarnings("unchecked")  RuleAdapter(Object rulePojo, Rule rule); @SuppressWarnings("unchecked")  RuleAdapter(Object rulePojo); @Override @SuppressWarnings("unchecked") Decision given(Fact... facts); @Override @SuppressWarnings("unchecked") Decision given(List list); @Override @SuppressWarnings("unchecked") Decision given(FactMap facts); @Override @SuppressWarnings("unchecked") Decision given(String name, Object value); @Override Decision givenUnTyped(FactMap facts); @Override Predicate getWhen(); @Override List<Object> getThen(); @Override void run(Object... otherArgs); @Override Decision when(Predicate test); @Override Decision then(Consumer action); @Override Decision then(BiConsumer action); @Override Decision using(String... factName); @Override Decision stop(); @Override Object getResult(); @Override void setResult(Result result); @Override FactMap getFactMap(); @Override void setNextRule(Rule rule); }
RuleAdapter implements Decision { @Override public List<Object> getThen() { if ((_rule.getThen()).size() < 1) { List<Object> thenList = new ArrayList<>(); for (Method thenMethod : getAnnotatedMethods(Then.class, _rulePojo.getClass())) { thenMethod.setAccessible(true); Object then = getThenMethodAsBiConsumer(thenMethod).map(Object.class::cast) .orElse(getThenMethodAsConsumer(thenMethod).orElse(factMap -> { })); thenList.add(then); } (_rule.getThen()).addAll(thenList); } return _rule.getThen(); } @SuppressWarnings("unchecked")  RuleAdapter(Object rulePojo, Rule rule); @SuppressWarnings("unchecked")  RuleAdapter(Object rulePojo); @Override @SuppressWarnings("unchecked") Decision given(Fact... facts); @Override @SuppressWarnings("unchecked") Decision given(List list); @Override @SuppressWarnings("unchecked") Decision given(FactMap facts); @Override @SuppressWarnings("unchecked") Decision given(String name, Object value); @Override Decision givenUnTyped(FactMap facts); @Override Predicate getWhen(); @Override List<Object> getThen(); @Override void run(Object... otherArgs); @Override Decision when(Predicate test); @Override Decision then(Consumer action); @Override Decision then(BiConsumer action); @Override Decision using(String... factName); @Override Decision stop(); @Override Object getResult(); @Override void setResult(Result result); @Override FactMap getFactMap(); @Override void setNextRule(Rule rule);  }