Entity
- The Entity type.Dto
- The Dto type.public abstract class SimpleQueryInOutMapperBase<Entity,Dto> extends Object implements QueryInOutMapper<Entity>
Constructor and Description |
---|
SimpleQueryInOutMapperBase() |
Modifier and Type | Method and Description |
---|---|
protected Entity |
findEntity(Object primaryKey) |
protected abstract Object |
getPrimaryKey(Dto dto)
Return the primary key of the Entity corresponding to the Dto.
|
Object |
mapParameter(Object parameter)
Map a query parameter.
|
Object |
mapResult(Entity result)
Map a single result query.
|
Object |
mapResultList(List<Entity> result)
Map a query result list.
|
boolean |
mapsParameter(Object parameter)
Check if this mapper handles a specific input parameter.
|
protected Entity |
newEntity() |
protected abstract Dto |
toDto(Entity entity) |
protected abstract Entity |
toEntity(Entity entity,
Dto dto)
Map a Dto to an Entity.
|
protected abstract Object getPrimaryKey(Dto dto)
null
.dto
- The Dto to map to an Entity.null
for a new Entity.protected abstract Entity toEntity(Entity entity, Dto dto)
entity
- Either a managed Entity looked up by the primary key,
or a new Entity instance.dto
- The Dto to map.public Object mapResult(Entity result)
QueryInOutMapper
mapResult
in interface QueryInOutMapper<Entity>
result
- The query result to map.public Object mapResultList(List<Entity> result)
QueryInOutMapper
mapResultList
in interface QueryInOutMapper<Entity>
result
- The query result list to map.public boolean mapsParameter(Object parameter)
QueryInOutMapper
mapsParameter
in interface QueryInOutMapper<Entity>
parameter
- The parameter candidate for mapping.true
if the mapper handles the parameter.public Object mapParameter(Object parameter)
QueryInOutMapper
mapParameter
in interface QueryInOutMapper<Entity>
parameter
- The parameter to map. It can be assumed that the
QueryInOutMapper.mapsParameter(Object)
method has been
called before with this parameter.protected Entity newEntity()
Copyright © 2015 The Apache Software Foundation. All rights reserved.