Attribute implements AttributeMerger<T>, AttributeCopy<T> { public boolean internal_isUserReadOnly() { if (userReadOnly){ return true; } if (readyOnlySupplier!=null){ return readyOnlySupplier.get(); } return false; } 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_dynamic_readonly(){ DynamicReadOnlyData dynamicReadOnlyData = new DynamicReadOnlyData(); dynamicReadOnlyData.barred.set(false); DynamicReadOnlyData2 data2 = new DynamicReadOnlyData2(); data2.attribute.set("123"); dynamicReadOnlyData.strangeList.add(data2); dynamicReadOnlyData.internal().finalise(); Assertions.assertFalse(data2.attribute.internal_isUserReadOnly()); dynamicReadOnlyData.barred.set(true); Assertions.assertTrue(data2.attribute.internal_isUserReadOnly()); }