Package org.apache.tapestry5.internal.services

## Class ComponentDefaultProviderImpl

- java.lang.Object
- - org.apache.tapestry5.internal.services.ComponentDefaultProviderImpl

- All Implemented Interfaces:
    `ComponentDefaultProvider`

      public class ComponentDefaultProviderImpl
      extends Object
      implements ComponentDefaultProvider

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ComponentDefaultProviderImpl​(PropertyAccess propertyAccess, BindingSource bindingSource, ValueEncoderSource valueEncoderSource, FieldTranslatorSource fieldTranslatorSource, FieldValidatorDefaultSource fieldValidatorDefaultSource)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Binding` | `defaultBinding​(String parameterName, ComponentResources resources)` | Checks to see if the container of the component (identified by its resources) contains a property matching the component's id.
    `String` | `defaultLabel​(ComponentResources resources)` | Computes the default label for the component (which will generally be a `Field`).
    `FieldTranslator` | `defaultTranslator​(String parameterName, ComponentResources resources)` | Provides a translator based on the bound parameter type, if possible.
    `Binding` | `defaultTranslatorBinding​(String parameterName, ComponentResources resources)` | Provides a binding that itself provides the field translator.
    `FieldValidator` | `defaultValidator​(String parameterName, ComponentResources resources)` | Provides a validator based on the bound parameter type.
    `Binding` | `defaultValidatorBinding​(String parameterName, ComponentResources resources)` | Provides a binding that itself provides the field translator.
    `ValueEncoder` | `defaultValueEncoder​(String parameterName, ComponentResources resources)` | Gets or creates a value encoder based on the type of the named parameter.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ComponentDefaultProviderImpl

          public ComponentDefaultProviderImpl​(PropertyAccess propertyAccess,
                                              BindingSource bindingSource,
                                              ValueEncoderSource valueEncoderSource,
                                              FieldTranslatorSource fieldTranslatorSource,
                                              FieldValidatorDefaultSource fieldValidatorDefaultSource)

  - ### Method Detail

    - #### defaultLabel

          public String defaultLabel​(ComponentResources resources)

      Description copied from interface: `ComponentDefaultProvider`
      Computes the default label for the component (which will generally be a `Field`).
      Specified by:
        `defaultLabel` in interface `ComponentDefaultProvider`
      Returns:
        the label, either extracted from the component's container's message catalog, or derived from the component's `ComponentResourcesCommon.getId()`.

    - #### defaultBinding

          public Binding defaultBinding​(String parameterName,
                                        ComponentResources resources)

      Description copied from interface: `ComponentDefaultProvider`
      Checks to see if the container of the component (identified by its resources) contains a property matching the component's id. If so, a binding for that property is returned. This is usually the default for a `Field`'s value parameter (or equivalent).
      Specified by:
        `defaultBinding` in interface `ComponentDefaultProvider`
      Parameters:
        `parameterName` - the name of the parameter
        `resources` - the resources of the component for which a binding is needed
      Returns:
        the binding, or null if the container does not have a matching property

    - #### defaultValueEncoder

          public ValueEncoder defaultValueEncoder​(String parameterName,
                                                  ComponentResources resources)

      Description copied from interface: `ComponentDefaultProvider`
      Gets or creates a value encoder based on the type of the named parameter. ValueEncoders are cached based on type.
      Specified by:
        `defaultValueEncoder` in interface `ComponentDefaultProvider`
      Parameters:
        `parameterName` - the name of the parameter whose type is used to locate a `ValueEncoderFactory`
        `resources` - the resources of the component, from which parameter and its type are extracted
      Returns:
        the value encoder, or null if the type of the parameter is not known

    - #### defaultTranslator

          public FieldTranslator defaultTranslator​(String parameterName,
                                                   ComponentResources resources)

      Description copied from interface: `ComponentDefaultProvider`
      Provides a translator based on the bound parameter type, if possible.
      Specified by:
        `defaultTranslator` in interface `ComponentDefaultProvider`
      Returns:
        the translator, or null

    - #### defaultTranslatorBinding

          public Binding defaultTranslatorBinding​(String parameterName,
                                                  ComponentResources resources)

      Description copied from interface: `ComponentDefaultProvider`
      Provides a binding that itself provides the field translator.
      Specified by:
        `defaultTranslatorBinding` in interface `ComponentDefaultProvider`
      Returns:
        binding that provides the `FieldTranslator`

    - #### defaultValidator

          public FieldValidator defaultValidator​(String parameterName,
                                                 ComponentResources resources)

      Description copied from interface: `ComponentDefaultProvider`
      Provides a validator based on the bound parameter type. If the property type of the parameter is not known, then a no-op validator is returned.
      Specified by:
        `defaultValidator` in interface `ComponentDefaultProvider`
      Returns:
        the validator, possibly a no-op validator

    - #### defaultValidatorBinding

          public Binding defaultValidatorBinding​(String parameterName,
                                                 ComponentResources resources)

      Description copied from interface: `ComponentDefaultProvider`
      Provides a binding that itself provides the field translator.
      Specified by:
        `defaultValidatorBinding` in interface `ComponentDefaultProvider`
      Returns:
        binding that provides the `FieldTranslator`