Package org.jboss.resteasy.core

## Class AbstractCollectionFormInjector<T>

- java.lang.Object
- - org.jboss.resteasy.core.FormInjector
  - - org.jboss.resteasy.core.PrefixedFormInjector
    - - org.jboss.resteasy.core.AbstractCollectionFormInjector<T>

- Type Parameters:
    `T` - The type of collection that will be created.
  All Implemented Interfaces:
    `ValueInjector`
  Direct Known Subclasses:
    `ListFormInjector`, `MapFormInjector`

      public abstract class AbstractCollectionFormInjector<T>
      extends PrefixedFormInjector

  Abstract implementation of `ValueInjector` that can inject collections.

- - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `AbstractCollectionFormInjector​(Class collectionType, Class genericType, String prefix, Pattern pattern, ResteasyProviderFactory factory)` | Creates an injector to inject a collection.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected abstract void` | `addTo​(T collection, String key, Object value)` | Adds the item to the collection.
    `protected abstract T` | `createInstance​(Class collectionType)` | Creates an instance of the collection type.
    `Object` | `inject​(HttpRequest request, HttpResponse response, boolean unwrapAsync)` | Inject inside the context of an HTTP request.

    - ### Methods inherited from class org.jboss.resteasy.core.PrefixedFormInjector

      `doInject, hasValue`

    - ### Methods inherited from class org.jboss.resteasy.core.FormInjector

      `inject`

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

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

- - ### Constructor Detail

    - #### AbstractCollectionFormInjector

          protected AbstractCollectionFormInjector​(Class collectionType,
                                                   Class genericType,
                                                   String prefix,
                                                   Pattern pattern,
                                                   ResteasyProviderFactory factory)

      Creates an injector to inject a collection.
      Parameters:
        `collectionType` - The type of collection to return.
        `genericType` - The type of elements in the collection.
        `prefix` - prefix
        `pattern` - The pattern that a field name should follow to be a part of this collection. The first group in the pattern must be the index.
        `factory` - provider factory

  - ### Method Detail

    - #### inject

          public Object inject​(HttpRequest request,
                               HttpResponse response,
                               boolean unwrapAsync)

      Inject inside the context of an HTTP request. Wraps the request in a Creates a collection instance and fills it with content by using the super implementation.
      Specified by:
        `inject` in interface `ValueInjector`
      Overrides:
        `inject` in class `PrefixedFormInjector`
      Parameters:
        `request` - http request
        `response` - http response
        `unwrapAsync` - unwrap async
      Returns:
        object

    - #### createInstance

          protected abstract T createInstance​(Class collectionType)

      Creates an instance of the collection type.
      Parameters:
        `collectionType` - collection type
      Returns:
        object instance of type T

    - #### addTo

          protected abstract void addTo​(T collection,
                                        String key,
                                        Object value)

      Adds the item to the collection.
      Parameters:
        `collection` - collection
        `key` - key
        `value` - value