@SuppressWarnings("rawtypes") public final class DataBindingUtils extends Object
Utility methods to perform data binding from Grails objects.
Modifiers | Name | Description |
---|---|---|
static String |
DATA_BINDER_BEAN_NAME |
Type Params | Return Type | Name and description |
---|---|---|
|
public static void |
assignBidirectionalAssociations(Object object, Map source, PersistentEntity persistentEntity) Associations both sides of any bidirectional relationships found in the object and source map to bind |
|
public static org.springframework.validation.BindingResult |
bindObjectToDomainInstance(PersistentEntity entity, Object object, Object source) Binds the given source object to the given target object performing type conversion if necessary |
|
public static org.springframework.validation.BindingResult |
bindObjectToDomainInstance(PersistentEntity entity, Object object, Object source, List include, List exclude, String filter) Binds the given source object to the given target object performing type conversion if necessary |
|
public static org.springframework.validation.BindingResult |
bindObjectToInstance(Object object, Object source) Binds the given source object to the given target object performing type conversion if necessary |
|
public static org.springframework.validation.BindingResult |
bindObjectToInstance(Object object, Object source, List include, List exclude, String filter) Binds the given source object to the given target object performing type conversion if necessary |
<T> |
public static void |
bindToCollection(Class<T> targetType, Collection<T> collectionToPopulate, CollectionDataBindingSource collectionBindingSource) For each DataBindingSource provided by collectionBindingSource a new instance of targetType is created, data binding is imposed on that instance with the DataBindingSource and the instance is added to the end of collectionToPopulate |
<T> |
public static void |
bindToCollection(Class<T> targetType, Collection<T> collectionToPopulate, ServletRequest request) |
|
public static Map |
convertPotentialGStrings(Map<Object, Object> args) |
|
public static CollectionDataBindingSource |
createCollectionDataBindingSource(GrailsApplication grailsApplication, Class bindingTargetType, Object bindingSource) |
|
public static DataBindingSource |
createDataBindingSource(GrailsApplication grailsApplication, Class bindingTargetType, Object bindingSource) |
|
protected static List |
getBindingIncludeList(Object object) |
|
public static DataBindingSourceRegistry |
getDataBindingSourceRegistry(GrailsApplication grailsApplication) |
|
protected static String[] |
getMessageCodes(String messageCode, Class objectType) |
|
public static MimeType |
getMimeType(GrailsApplication grailsApplication, Object bindingSource) |
|
public static MimeTypeResolver |
getMimeTypeResolver(GrailsApplication grailsApplication) |
|
public static MimeType |
resolveMimeType(Object bindingSource, MimeTypeResolver mimeTypeResolver) |
Associations both sides of any bidirectional relationships found in the object and source map to bind
object
- The objectsource
- The source mappersistentEntity
- The PersistentEntity for the objectBinds the given source object to the given target object performing type conversion if necessary
entity
- The PersistentEntity instanceobject
- The object to bind tosource
- The source objectBinds the given source object to the given target object performing type conversion if necessary
entity
- The PersistentEntity instanceobject
- The object to bind tosource
- The source objectinclude
- The list of properties to includeexclude
- The list of properties to excludefilter
- The prefix to filter byBinds the given source object to the given target object performing type conversion if necessary
object
- The object to bind tosource
- The source objectBinds the given source object to the given target object performing type conversion if necessary
object
- The object to bind tosource
- The source objectinclude
- The list of properties to includeexclude
- The list of properties to excludefilter
- The prefix to filter byFor each DataBindingSource provided by collectionBindingSource a new instance of targetType is created, data binding is imposed on that instance with the DataBindingSource and the instance is added to the end of collectionToPopulate
targetType
- The type of objects to create, must be a concrete classcollectionToPopulate
- A collection to populate with new instances of targetTypecollectionBindingSource
- A CollectionDataBindingSource