@Test public void testStringAttr() { @SuppressWarnings("unused") class Clazz extends AttrComposite { AttrString attr = attributes.register("attr", AttrString.builder().defaultValue("foo")); AttrString attrNull = attributes.register("attrNull", AttrString.builder().defaultValue(null)); } ClassInfoCollector collector = new ClassInfoCollector(JvmNameMapper.INSTANCE); ClassInfo classInfo = collector.collect(new Clazz()); Assertions.assertThat(classInfo.attributes) .hasEntrySatisfying("attr", info -> Assertions.assertThat(info.value).isEqualTo("foo")) .hasEntrySatisfying("attrNull", info -> Assertions.assertThat(info.value).isNull()); }
public ClassInfo collect(AcceptingVisitor c) { return collected.computeIfAbsent( c.getClass(), (key) -> { final ClassInfo ci = new ClassInfo(); ci.clazz = c.getClass(); ci.name = aliasMapper.toName(c); ci.type = getQualifiedName(c.getClass()); c.accept(new AttrInfoCollector(ci.attributes, aliasMapper)); return ci; }); }
ClassInfoCollector { public ClassInfo collect(AcceptingVisitor c) { return collected.computeIfAbsent( c.getClass(), (key) -> { final ClassInfo ci = new ClassInfo(); ci.clazz = c.getClass(); ci.name = aliasMapper.toName(c); ci.type = getQualifiedName(c.getClass()); c.accept(new AttrInfoCollector(ci.attributes, aliasMapper)); return ci; }); } }
ClassInfoCollector { public ClassInfo collect(AcceptingVisitor c) { return collected.computeIfAbsent( c.getClass(), (key) -> { final ClassInfo ci = new ClassInfo(); ci.clazz = c.getClass(); ci.name = aliasMapper.toName(c); ci.type = getQualifiedName(c.getClass()); c.accept(new AttrInfoCollector(ci.attributes, aliasMapper)); return ci; }); } ClassInfoCollector(ClassNameMapper aliasMapper); }
ClassInfoCollector { public ClassInfo collect(AcceptingVisitor c) { return collected.computeIfAbsent( c.getClass(), (key) -> { final ClassInfo ci = new ClassInfo(); ci.clazz = c.getClass(); ci.name = aliasMapper.toName(c); ci.type = getQualifiedName(c.getClass()); c.accept(new AttrInfoCollector(ci.attributes, aliasMapper)); return ci; }); } ClassInfoCollector(ClassNameMapper aliasMapper); ClassInfo collect(AcceptingVisitor c); static String getQualifiedName(Class<?> clazz); }
ClassInfoCollector { public ClassInfo collect(AcceptingVisitor c) { return collected.computeIfAbsent( c.getClass(), (key) -> { final ClassInfo ci = new ClassInfo(); ci.clazz = c.getClass(); ci.name = aliasMapper.toName(c); ci.type = getQualifiedName(c.getClass()); c.accept(new AttrInfoCollector(ci.attributes, aliasMapper)); return ci; }); } ClassInfoCollector(ClassNameMapper aliasMapper); ClassInfo collect(AcceptingVisitor c); static String getQualifiedName(Class<?> clazz);  }