@Test public void testPrimitiveDataSanitization() throws Exception { Root root = new Root( " root1 ", new Child(" child1 ", 1, 2), new NullableChild(" child2 ") ); Optional<Object> sanitizedOpt = new StdValueSanitizer(type -> true).apply(root); assertThat(sanitizedOpt).isPresent(); Root sanitized = (Root) sanitizedOpt.get(); assertThat(sanitized.getName()).isEqualTo("root1"); assertThat(sanitized.getChild().getChildName()).isEqualTo("child1"); assertThat(sanitized.getChild().getMin()).isEqualTo(1); assertThat(sanitized.getChild().getMax()).isEqualTo(2); assertThat(sanitized.getNullableChild().getOptionalValue()).isEqualTo("child2"); }
@Override public Optional<Object> apply(Object entity) { return apply(entity, NOTHING); }
StdValueSanitizer extends AbstractFieldSanitizer<Object> { @Override public Optional<Object> apply(Object entity) { return apply(entity, NOTHING); } }
StdValueSanitizer extends AbstractFieldSanitizer<Object> { @Override public Optional<Object> apply(Object entity) { return apply(entity, NOTHING); } StdValueSanitizer(Function<Class<?>, Boolean> innerEntityPredicate); }
StdValueSanitizer extends AbstractFieldSanitizer<Object> { @Override public Optional<Object> apply(Object entity) { return apply(entity, NOTHING); } StdValueSanitizer(Function<Class<?>, Boolean> innerEntityPredicate); @Override Optional<Object> apply(Object entity); }
StdValueSanitizer extends AbstractFieldSanitizer<Object> { @Override public Optional<Object> apply(Object entity) { return apply(entity, NOTHING); } StdValueSanitizer(Function<Class<?>, Boolean> innerEntityPredicate); @Override Optional<Object> apply(Object entity);  }