@Test public void no_matching_property_for_default() { String parameterName = "myparam"; String id = "mycomponentid"; ComponentResources resources = mockComponentResources(); Component container = mockComponent(); PropertyAccess access = mockPropertyAccess(); ClassPropertyAdapter classPropertyAdapter = mockClassPropertyAdapter(); BindingSource bindingSource = mockBindingSource(); train_getId(resources, id); train_getContainer(resources, container); train_getAdapter(access, container, classPropertyAdapter); train_getPropertyAdapter(classPropertyAdapter, id, null); replay(); ComponentDefaultProvider source = new ComponentDefaultProviderImpl(access, bindingSource, null, null, null); assertNull(source.defaultBinding(parameterName, resources)); verify(); }
public Binding defaultBinding(String parameterName, ComponentResources resources) { assert InternalUtils.isNonBlank(parameterName); assert resources != null; String componentId = resources.getId(); Component container = resources.getContainer(); if (propertyAccess.getAdapter(container).getPropertyAdapter(componentId) == null) return null; ComponentResources containerResources = resources.getContainerResources(); return bindingSource.newBinding( "default " + parameterName, containerResources, BindingConstants.PROP, componentId); }
ComponentDefaultProviderImpl implements ComponentDefaultProvider { public Binding defaultBinding(String parameterName, ComponentResources resources) { assert InternalUtils.isNonBlank(parameterName); assert resources != null; String componentId = resources.getId(); Component container = resources.getContainer(); if (propertyAccess.getAdapter(container).getPropertyAdapter(componentId) == null) return null; ComponentResources containerResources = resources.getContainerResources(); return bindingSource.newBinding( "default " + parameterName, containerResources, BindingConstants.PROP, componentId); } }
ComponentDefaultProviderImpl implements ComponentDefaultProvider { public Binding defaultBinding(String parameterName, ComponentResources resources) { assert InternalUtils.isNonBlank(parameterName); assert resources != null; String componentId = resources.getId(); Component container = resources.getContainer(); if (propertyAccess.getAdapter(container).getPropertyAdapter(componentId) == null) return null; ComponentResources containerResources = resources.getContainerResources(); return bindingSource.newBinding( "default " + parameterName, containerResources, BindingConstants.PROP, componentId); } ComponentDefaultProviderImpl(PropertyAccess propertyAccess, BindingSource bindingSource,
                                        ValueEncoderSource valueEncoderSource,
                                        FieldTranslatorSource fieldTranslatorSource,
                                        FieldValidatorDefaultSource fieldValidatorDefaultSource); }
ComponentDefaultProviderImpl implements ComponentDefaultProvider { public Binding defaultBinding(String parameterName, ComponentResources resources) { assert InternalUtils.isNonBlank(parameterName); assert resources != null; String componentId = resources.getId(); Component container = resources.getContainer(); if (propertyAccess.getAdapter(container).getPropertyAdapter(componentId) == null) return null; ComponentResources containerResources = resources.getContainerResources(); return bindingSource.newBinding( "default " + parameterName, containerResources, BindingConstants.PROP, componentId); } ComponentDefaultProviderImpl(PropertyAccess propertyAccess, BindingSource bindingSource,
                                        ValueEncoderSource valueEncoderSource,
                                        FieldTranslatorSource fieldTranslatorSource,
                                        FieldValidatorDefaultSource fieldValidatorDefaultSource); String defaultLabel(ComponentResources resources); Binding defaultBinding(String parameterName, ComponentResources resources); @SuppressWarnings({ "unchecked" }) ValueEncoder defaultValueEncoder(String parameterName, ComponentResources resources); FieldTranslator defaultTranslator(String parameterName, ComponentResources resources); Binding defaultTranslatorBinding(final String parameterName, final ComponentResources resources); FieldValidator defaultValidator(String parameterName, ComponentResources resources); Binding defaultValidatorBinding(final String parameterName, final ComponentResources resources); }
ComponentDefaultProviderImpl implements ComponentDefaultProvider { public Binding defaultBinding(String parameterName, ComponentResources resources) { assert InternalUtils.isNonBlank(parameterName); assert resources != null; String componentId = resources.getId(); Component container = resources.getContainer(); if (propertyAccess.getAdapter(container).getPropertyAdapter(componentId) == null) return null; ComponentResources containerResources = resources.getContainerResources(); return bindingSource.newBinding( "default " + parameterName, containerResources, BindingConstants.PROP, componentId); } ComponentDefaultProviderImpl(PropertyAccess propertyAccess, BindingSource bindingSource,
                                        ValueEncoderSource valueEncoderSource,
                                        FieldTranslatorSource fieldTranslatorSource,
                                        FieldValidatorDefaultSource fieldValidatorDefaultSource); String defaultLabel(ComponentResources resources); Binding defaultBinding(String parameterName, ComponentResources resources); @SuppressWarnings({ "unchecked" }) ValueEncoder defaultValueEncoder(String parameterName, ComponentResources resources); FieldTranslator defaultTranslator(String parameterName, ComponentResources resources); Binding defaultTranslatorBinding(final String parameterName, final ComponentResources resources); FieldValidator defaultValidator(String parameterName, ComponentResources resources); Binding defaultValidatorBinding(final String parameterName, final ComponentResources resources);  }