org.appng.api

## Interface RequestSupport

- All Superinterfaces:
    org.springframework.core.convert.ConversionService
  All Known Subinterfaces:
    Request
  All Known Implementing Classes:
    ApplicationRequest, RequestSupportImpl

      public interface RequestSupport
      extends org.springframework.core.convert.ConversionService

  Provides commonly used methods for supporting request-processing and filling bindobjects.
  Author:
    Matthias Müller

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addErrorMessage(FieldProcessor fp, MessageParam messageParam)` Adds an error to the `FieldProcessor` using `FieldProcessor.addErrorMessage(String)`.
    `void` | `addErrorMessage(FieldProcessor fp, MessageParam messageParam, String fieldBinding)` Adds an error to a `FieldDef` using `FieldProcessor.addErrorMessage(org.appng.xml.platform.FieldDef, String)`.
    `void` | `fillBindObject(Object bindobject, FieldProcessor fp, RequestContainer container, ClassLoader classLoader)` Fills the given `bindobject` with the (converted) values provided by a `RequestContainer`.
    `Object` | `getBindObject(FieldProcessor fp, RequestContainer container, ClassLoader classLoader)` Creates, fills and returns a new bindobject.
    `Environment` | `getEnvironment()` Returns the `Environment` for this `Request`.
    `FieldConverter` | `getFieldConverter()` Returns a `FieldConverter`
    `String` | `getMessage(String key, Object... args)` Retrieves a message from the underlying `MessageSource`, using the `Locale` provided by `Environment.getLocale()`.
    `org.springframework.context.MessageSource` | `getMessageSource()` Returns the currently used `MessageSource`
    `void` | `handleException(FieldProcessor fp, Exception e)` Handles an `Exception`.
    `<T> void` | `setPropertyValue(T source, T target, String property)` Copies the property from `source` to `target`.
    `<T> void` | `setPropertyValues(T source, T target, MetaData metaData)` Copies the fields defined by the given `MetaData` from `source` to `target`.

    - ### Methods inherited from interface org.springframework.core.convert.ConversionService

      `canConvert, canConvert, convert, convert`

- - ### Method Detail

    - #### getFieldConverter

          FieldConverter getFieldConverter()

      Returns a `FieldConverter`
      Returns:
        a `FieldConverter`

    - #### handleException

          void handleException(FieldProcessor fp,
                               Exception e)
                        throws BusinessException

      Handles an `Exception`. If the given Exception is a `BusinessException`, the very same `BusinessException` is being re-thrown. Otherwise, the `Exception` is being wrapped into a new `BusinessException` which is then being thrown.
      If the given `Exception` is a `MessageParam`, `addErrorMessage(FieldProcessor, MessageParam)` is being called.
      Parameters:
        `fp` - a `FieldProcessor`
        `e` - an `Exception`
      Throws:
        `BusinessException`
      See Also:
        `MessageParam`, `addErrorMessage(FieldProcessor, MessageParam)`

    - #### addErrorMessage

          void addErrorMessage(FieldProcessor fp,
                               MessageParam messageParam)

      Adds an error to the `FieldProcessor` using `FieldProcessor.addErrorMessage(String)`. `MessageParam.getMessageKey()` is used for the message key, `MessageParam.getMessageArgs()` for the message arguments.
      Parameters:
        `fp` - a `FieldProcessor`
        `messageParam` - a `MessageParam`
      See Also:
        `MessageParam`

    - #### addErrorMessage

          void addErrorMessage(FieldProcessor fp,
                               MessageParam messageParam,
                               String fieldBinding)

      Adds an error to a `FieldDef` using `FieldProcessor.addErrorMessage(org.appng.xml.platform.FieldDef, String)`. `MessageParam.getMessageKey()` is used for the message key, `MessageParam.getMessageArgs()` for the message arguments.
      Parameters:
        `fp` - a `FieldProcessor`
        `messageParam` - a `MessageParam`
        `fieldBinding` - the binding of the `FieldDef` to add the error to
      See Also:
        `MessageParam`

    - #### setPropertyValues

          <T> void setPropertyValues(T source,
                                     T target,
                                     MetaData metaData)

      Copies the fields defined by the given `MetaData` from `source` to `target`.
      Parameters:
        `source` - the source object to read the fields from
        `target` - the target object to write the fields to
        `metaData` - the `MetaData`
      Throws:
        `IllegalArgumentException` - if the type of `T` is incompatible to `MetaData.getBindClass()` or the bindclass can not be found.

    - #### setPropertyValue

          <T> void setPropertyValue(T source,
                                    T target,
                                    String property)

      Copies the property from `source` to `target`.
      Parameters:
        `source` - the source object to read the property from
        `target` - the target object to write the property to
        `property` - the name of the property to set

    - #### getBindObject

          Object getBindObject(FieldProcessor fp,
                               RequestContainer container,
                               ClassLoader classLoader)
                        throws BusinessException

      Creates, fills and returns a new bindobject. The type of the returned object is obtained from `fp.getMetaData().getBindClass()`. The `MetaData`'s `FieldDef`initions are responsible for which fields are getting filled.
      Parameters:
        `fp` - the current `FieldProcessor`
        `container` - the `RequestContainer` used to retrieve the values for filling the bindobject
        `classLoader` - the `ClassLoader` used to load the bindclass
      Returns:
        a new bindobject
      Throws:
        `BusinessException` - if the bindclass could not be loaded, instantiated or initialized, or if an error occurred during filling the bindobject
      See Also:
        `fillBindObject(Object, FieldProcessor, RequestContainer, ClassLoader)`

    - #### fillBindObject

          void fillBindObject(Object bindobject,
                              FieldProcessor fp,
                              RequestContainer container,
                              ClassLoader classLoader)
                       throws BusinessException

      Fills the given `bindobject` with the (converted) values provided by a `RequestContainer`. The type of the `bindobject` must match `fp.getMetaData().getBindClass()`. The `MetaData`'s `FieldDef`initions are responsible for which fields are getting filled.
      Parameters:
        `bindobject` - the bindobject to fill
        `fp` - the current `FieldProcessor`
        `container` - the `RequestContainer` used to retrieve the values for filling the bindobject
        `classLoader` - the `ClassLoader` used to load the bindclass
      Throws:
        `BusinessException` -
        - if the type of the `bindobject` is not assignable from the type returned by `fp.getMetaData().getBindClass()`
        - if the type returned by `fp.getMetaData().getBindClass()` can not be instanciated

    - #### getMessageSource

          org.springframework.context.MessageSource getMessageSource()

      Returns the currently used `MessageSource`
      Returns:
        a `MessageSource`

    - #### getMessage

          String getMessage(String key,
                            Object... args)

      Retrieves a message from the underlying `MessageSource`, using the `Locale` provided by `Environment.getLocale()`.
      Parameters:
        `key` - the message key
        `args` - the message arguments

    - #### getEnvironment

          Environment getEnvironment()

      Returns the `Environment` for this `Request`.
      Returns:
        the `Environment`

Copyright © 2011–2023 aiticon GmbH. All rights reserved.