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 ofNestedFormInjector
that can inject collections.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Class
collectionType
private java.util.regex.Pattern
pattern
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractCollectionFormInjector(java.lang.Class collectionType, java.lang.Class genericType, java.lang.String prefix, java.util.regex.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, java.lang.String key, java.lang.Object value)
Adds the item to the collection.protected abstract T
createInstance(java.lang.Class collectionType)
Creates an instance of the collection type.private java.util.Set<java.lang.String>
findMatchingPrefixesWithNoneEmptyValues(javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> parameters)
Finds all field names that follow the pattern.java.lang.Object
inject(HttpRequest request, HttpResponse response)
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
-
-
-
-
Constructor Detail
-
AbstractCollectionFormInjector
protected AbstractCollectionFormInjector(java.lang.Class collectionType, java.lang.Class genericType, java.lang.String prefix, java.util.regex.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.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.
-
-
Method Detail
-
inject
public java.lang.Object inject(HttpRequest request, HttpResponse response)
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 interfaceValueInjector
- Overrides:
inject
in classPrefixedFormInjector
- Returns:
-
findMatchingPrefixesWithNoneEmptyValues
private java.util.Set<java.lang.String> findMatchingPrefixesWithNoneEmptyValues(javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> parameters)
Finds all field names that follow the pattern.
-
createInstance
protected abstract T createInstance(java.lang.Class collectionType)
Creates an instance of the collection type.
-
addTo
protected abstract void addTo(T collection, java.lang.String key, java.lang.Object value)
Adds the item to the collection.
-
-