public SpecificationRunnerMonitorProxy(Object proxied) { if ( ! DuckType.instanceOf(SpecificationRunnerMonitor.class, proxied)) { throw new IllegalArgumentException("Not a SpecificationRunnerMonitor: " + proxied.getClass().getName()); } this.proxied = DuckType.implement(SpecificationRunnerMonitor.class, proxied); }
private String regularExpressionOf(Annotation paramAnnotation) { if (DuckType.instanceOf(RegEx.class, paramAnnotation)) { try { RegEx regEx = DuckType.implement(RegEx.class, paramAnnotation); return regEx.value(); } catch (Exception e) { LOG.error(LOG_ERROR, e); // Not a valid RegEx annotation } } return null; }
private static BreachSpecificationEncapsulation breachEncapsulation(Example example) { if ( ! DuckType.instanceOf(BreachSpecificationEncapsulation.class, example)) { throw new IllegalArgumentException("Cant' breach encapsulation of " + example.getClass().getName()); } return DuckType.implement(BreachSpecificationEncapsulation.class, example); } }
private static BreachSpecificationEncapsulation breachEncapsulation(Example example) { if ( ! DuckType.instanceOf(BreachSpecificationEncapsulation.class, example)) { throw new IllegalArgumentException("Cant' breach encapsulation of " + example.getClass().getName()); } return DuckType.implement(BreachSpecificationEncapsulation.class, example); } }