@Test public void test_naed_singelton_after_serialisation() { FactoryTreeBuilder<ExampleLiveObjectA,ExampleFactoryA> builder = createNamedListBuilder(); ExampleFactoryA root = builder.buildTreeUnvalidated(); ExampleFactoryA jsonCopy = ObjectMapperBuilder.build().copy(root); FactoryTreeBuilder<ExampleLiveObjectA,ExampleFactoryA> clientBuilder = createNamedListBuilder(); FactoryTreeBuilderBasedAttributeSetup<ExampleFactoryA> factoryTreeBuilderBasedAttributeSetup = new FactoryTreeBuilderBasedAttributeSetup<>(clientBuilder); factoryTreeBuilderBasedAttributeSetup.applyToRootFactoryDeep(jsonCopy); List<ExampleFactoryB> possibleValues = jsonCopy.referenceListAttribute.internal_createNewPossibleValues(FactoryMetadataManager.getMetadata(ExampleFactoryA.class).getAttributeMetadata(f->f.referenceListAttribute)); Assertions.assertTrue(possibleValues.get(0)==jsonCopy.referenceListAttribute.get(0)); Assertions.assertTrue(possibleValues.get(1)==jsonCopy.referenceListAttribute.get(1)); }
public void applyToRootFactoryDeep(R root) { root.internal().serFactoryTreeBuilderBasedAttributeSetupForRoot(this); root.internal().setFactoryTreeBuilder(this.factoryTreeBuilder); factoryTreeBuilder.fillFromExistingFactoryTree(root); root.internal().collectChildrenDeep().forEach(data -> { data.internal().visitAttributesFlat(this::applyToAttribute); }); }
FactoryTreeBuilderBasedAttributeSetup { public void applyToRootFactoryDeep(R root) { root.internal().serFactoryTreeBuilderBasedAttributeSetupForRoot(this); root.internal().setFactoryTreeBuilder(this.factoryTreeBuilder); factoryTreeBuilder.fillFromExistingFactoryTree(root); root.internal().collectChildrenDeep().forEach(data -> { data.internal().visitAttributesFlat(this::applyToAttribute); }); } }
FactoryTreeBuilderBasedAttributeSetup { public void applyToRootFactoryDeep(R root) { root.internal().serFactoryTreeBuilderBasedAttributeSetupForRoot(this); root.internal().setFactoryTreeBuilder(this.factoryTreeBuilder); factoryTreeBuilder.fillFromExistingFactoryTree(root); root.internal().collectChildrenDeep().forEach(data -> { data.internal().visitAttributesFlat(this::applyToAttribute); }); } FactoryTreeBuilderBasedAttributeSetup(FactoryTreeBuilder<?,R> factoryTreeBuilder); }
FactoryTreeBuilderBasedAttributeSetup { public void applyToRootFactoryDeep(R root) { root.internal().serFactoryTreeBuilderBasedAttributeSetupForRoot(this); root.internal().setFactoryTreeBuilder(this.factoryTreeBuilder); factoryTreeBuilder.fillFromExistingFactoryTree(root); root.internal().collectChildrenDeep().forEach(data -> { data.internal().visitAttributesFlat(this::applyToAttribute); }); } FactoryTreeBuilderBasedAttributeSetup(FactoryTreeBuilder<?,R> factoryTreeBuilder); @SuppressWarnings("unchecked") List<FO> createNewFactory(Class<LO> liveObjectClass); void applyToRootFactoryDeep(R root); }
FactoryTreeBuilderBasedAttributeSetup { public void applyToRootFactoryDeep(R root) { root.internal().serFactoryTreeBuilderBasedAttributeSetupForRoot(this); root.internal().setFactoryTreeBuilder(this.factoryTreeBuilder); factoryTreeBuilder.fillFromExistingFactoryTree(root); root.internal().collectChildrenDeep().forEach(data -> { data.internal().visitAttributesFlat(this::applyToAttribute); }); } FactoryTreeBuilderBasedAttributeSetup(FactoryTreeBuilder<?,R> factoryTreeBuilder); @SuppressWarnings("unchecked") List<FO> createNewFactory(Class<LO> liveObjectClass); void applyToRootFactoryDeep(R root);  }