Attribute implements AttributeMerger<T>, AttributeCopy<T> { public String internal_getPreferredLabelText(Locale locale){ if (locale.equals(this.customLocale)){ return customLocaleText; } if (en!=null && locale.equals(Locale.ENGLISH)){ return en; } if (de!=null && locale.equals(Locale.GERMAN)){ return de; } if (es!=null && locale.equals(SPANISH)){ return es; } if (fr!=null && locale.equals(Locale.FRANCE)){ return fr; } if (it!=null && locale.equals(Locale.ITALIAN)){ return it; } if (pt!=null && locale.equals(PORTUGUESE)){ return pt; } if (en!=null){ return en; } if (de!=null){ return de; } if (es!=null){ return es; } if (fr!=null){ return fr; } if (it!=null){ return it; } if (pt!=null){ return pt; } return ""; } Attribute(); @Override void internal_merge(T newValue); List<ValidationError> internal_validate(FactoryBase<?,?> parent, String attributeVariableName); boolean internal_required(); void internal_endUsage(); List<AttributeChangeListener<T,A>> internal_getListeners(); void internal_addListener(AttributeChangeListener<T,A> newListener); void internal_removeAllListener(); void internal_removeListener(AttributeChangeListener<T,A> removeListener); @JsonIgnore abstract String getDisplayText(); @SuppressWarnings("unchecked") A validation(Validation<T> validation); String internal_getPreferredLabelText(Locale locale); LanguageText internal_getLabelText(); String internal_getAddonText(); @Override boolean internal_hasWritePermission(Function<String,Boolean> permissionChecker); @SuppressWarnings("unchecked") A permission(String permission); @SuppressWarnings("unchecked") A addonText(String addonText); @SuppressWarnings("unchecked") A labelText(String text); @SuppressWarnings("unchecked") A labelText(String labelText, Locale locale); @SuppressWarnings("unchecked") A en(String text); @SuppressWarnings("unchecked") A de(String text); @SuppressWarnings("unchecked") A es(String text); @SuppressWarnings("unchecked") A fr(String text); @SuppressWarnings("unchecked") A it(String text); @SuppressWarnings("unchecked") A pt(String text); @SuppressWarnings("unchecked") A tooltipEn(String tooltip); @SuppressWarnings("unchecked") A tooltipDe(String tooltip); String internal_getPreferredTooltipText(Locale locale); boolean internal_isUserReadOnly(); @SuppressWarnings("unchecked") A userReadOnly(); @SuppressWarnings("unchecked") A userReadOnly(Supplier<Boolean> readyOnlySupplier); AttributeStorageMetadata createAttributeStorageMetadata(AttributeMetadata attributeMetadata); abstract void internal_reset();  }
@Test public void test_reconstructMetadataDeepRoot() throws Exception{ ExampleDataA exampleFactoryA = new ExampleDataA(); ExampleDataB exampleFactoryB = new ExampleDataB(); ExampleDataC exampleFactoryC = new ExampleDataC(); exampleFactoryB.referenceAttributeC.set(exampleFactoryC); exampleFactoryA.referenceAttribute.set(exampleFactoryB); exampleFactoryA.referenceListAttribute.add(new ExampleDataB()); SimpleObjectMapper mapper = ObjectMapperBuilder.build(); String string = mapper.writeValueAsString(exampleFactoryA); ExampleDataA readed = ObjectMapperBuilder.buildNewObjectMapper().readValue(string,ExampleDataA.class); readed.internal().finalise(); Assertions.assertEquals("ExampleA1",readed.stringAttribute.internal_getPreferredLabelText(Locale.ENGLISH)); Assertions.assertEquals("ExampleA2",readed.referenceAttribute.internal_getPreferredLabelText(Locale.ENGLISH)); Assertions.assertEquals("ExampleA3",readed.referenceListAttribute.internal_getPreferredLabelText(Locale.ENGLISH)); Assertions.assertEquals("ExampleB1",readed.referenceAttribute.get().stringAttribute.internal_getPreferredLabelText(Locale.ENGLISH)); Assertions.assertEquals("ExampleB1",readed.referenceListAttribute.get(0).stringAttribute.internal_getPreferredLabelText(Locale.ENGLISH)); Assertions.assertEquals(exampleFactoryA.getId(),readed.getId()); }