BeanModelType implements ComplexModelType<T> { public Map<String, Boolean> getClientUpdateAllowedProperties( Set<String> twoWayBindingPaths) { Map<String, Boolean> allowedProperties = new HashMap<>(); collectAllowedProperties("", allowedProperties, Collections.unmodifiableSet(twoWayBindingPaths)); return allowedProperties; } protected  BeanModelType(Class<T> proxyType,
            Map<String, BeanModelTypeProperty> properties,
            boolean allowEmptyProperties); private  BeanModelType(Class<T> javaType, PropertyFilter propertyFilter,
            PathLookup<ModelEncoder<?, ?>> converterLookup,
            PathLookup<ClientUpdateMode> clientUpdateLookup); protected  BeanModelType(Class<T> javaType, PropertyFilter propertyFilter,
            boolean allowEmptyProperties); static boolean isBean(Type type); boolean hasProperty(String propertyName); ModelType getPropertyType(String propertyName); @Override T modelToApplication(Serializable modelValue); Class<T> getProxyType(); @Override StateNode applicationToModel(Object applicationValue,
            PropertyFilter filter); void importProperties(ElementPropertyMap model, Object bean,
            PropertyFilter propertyFilter); ModelType resolveType(String modelPath); @Override @SuppressWarnings("unchecked") BeanModelType<C> cast(Class<C> proxyType); Stream<String> getPropertyNames(); @Override boolean accepts(Type applicationType); @Override Type getJavaType(); @Override JsonValue toJson(); @Override void createInitialValue(StateNode node, String property); void createInitialValues(StateNode node); Map<String, Boolean> getClientUpdateAllowedProperties(
            Set<String> twoWayBindingPaths);  }
@Test public void onlyDenyProperty_noAllowedProperties() { Assert.assertEquals(0, getClientUpdateAllowedProperties( DeniedPropertyWithGetterModel.class).size()); Assert.assertEquals(0, getClientUpdateAllowedProperties( DeniedPropertyWithGetterModel.class, "name").size()); }
@Test public void twoWayDatabindingPropertyDeclared_propertyIsNotAllowedIfNotTwoWayDataBinding() { Assert.assertEquals(0, getClientUpdateAllowedProperties( TwoWayBindingPropertyModel.class).size()); Assert.assertEquals(1, getClientUpdateAllowedProperties( TwoWayBindingPropertyModel.class, "name").size()); Assert.assertTrue(getClientUpdateAllowedProperties( TwoWayBindingPropertyModel.class, "name").get("name")); Assert.assertEquals(1, getClientUpdateAllowedProperties( TwoWayBindingPropertyModel.class, "age").size()); Assert.assertFalse(getClientUpdateAllowedProperties( TwoWayBindingPropertyModel.class, "age").get("age")); }
@Test public void allowPropertyDeclared_propertyIsAllowed() { Map<String, Boolean> properties = getClientUpdateAllowedProperties( AllowPropertyModel.class); Assert.assertEquals(2, properties.size()); Assert.assertTrue(properties.get("name")); Assert.assertFalse(properties.get("age")); }
@Test public void allowListSubPropertyDeclared_propertyIsAllowed() { Map<String, Boolean> properties = getClientUpdateAllowedProperties( ListPropertyModel.class, "list.booleanValue"); Assert.assertEquals(4, properties.size()); Assert.assertTrue(properties.get("list.booleanValue")); Assert.assertTrue(properties.get("list")); }
@Test public void denyListSubPropertyDeclared_propertyIsDisallowed() { Map<String, Boolean> properties = getClientUpdateAllowedProperties( ListPropertyModel.class, "list.intValue"); Assert.assertEquals(3, properties.size()); Assert.assertFalse(properties.containsKey("list.intValue")); Assert.assertTrue(properties.get("list")); }
@Test public void allowListSubPropertyDeclared_propertyIsTwoWayDataBinding_propertyIsAllowed() { Map<String, Boolean> properties = getClientUpdateAllowedProperties( ListPropertyModel.class, "list.doubleValue"); Assert.assertEquals(4, properties.size()); Assert.assertTrue(properties.get("list.doubleValue")); Assert.assertTrue(properties.get("list")); }
@Test public void denyListSubPropertyDeclared_propertyIsNotTwoWayDataBinding_propertyIsDisallowed() { Map<String, Boolean> properties = getClientUpdateAllowedProperties( ListPropertyModel.class); Assert.assertEquals(3, properties.size()); Assert.assertFalse(properties.containsKey("list.doubleValue")); Assert.assertTrue(properties.get("list")); }
@Test public void allowSubPropertyDeclared_propertyIsAllowed() { Map<String, Boolean> properties = getClientUpdateAllowedProperties( SubPropertyModel.class, "bean.booleanValue"); Assert.assertEquals(4, properties.size()); Assert.assertTrue(properties.get("bean.booleanValue")); Assert.assertTrue(properties.get("bean")); }
@Test public void denySubPropertyDeclared_propertyIsDisallowed() { Map<String, Boolean> properties = getClientUpdateAllowedProperties( SubPropertyModel.class, "bean.intValue"); Assert.assertEquals(3, properties.size()); Assert.assertFalse(properties.containsKey("bean.intValue")); Assert.assertTrue(properties.get("bean")); }
@Test public void allowSubPropertyDeclared_propertyIsTwoWayDataBinding_propertyIsAllowed() { Map<String, Boolean> properties = getClientUpdateAllowedProperties( SubPropertyModel.class, "bean.doubleValue"); Assert.assertEquals(4, properties.size()); Assert.assertTrue(properties.get("bean.doubleValue")); Assert.assertTrue(properties.get("bean")); }
@Test public void denySubPropertyDeclared_propertyIsNotTwoWayDataBinding_propertyIsDisallowed() { Map<String, Boolean> properties = getClientUpdateAllowedProperties( SubPropertyModel.class); Assert.assertEquals(3, properties.size()); Assert.assertFalse(properties.containsKey("bean.doubleValue")); Assert.assertTrue(properties.get("bean")); }