Interface ModelSearchStrategy
-
- All Known Implementing Classes:
DefaultItemModelSearchStrategy
public interface ModelSearchStrategyThis interface describes strategy for searching model instances by example model. Currently only used inModelService.getByExample(Object).
Example:
ProductModel exampleProduct = new ProductModel(); exampleProduct.setCode("test"); ModelConverter converter = defaultModelService.getModelConverterByModel(exampleProduct); ProductModel foundProduct = defaultItemModelSearchStrategy.getModelByExample(converter,exampleProduct);
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> TgetModelByExample(ModelConverter conv, T example)Search for an existing model by a given (not saved) example model.<T> java.util.List<T>getModelsByExample(ModelConverter conv, T example)Search for an existing models by a given (not saved) example model.
-
-
-
Method Detail
-
getModelByExample
<T> T getModelByExample(ModelConverter conv, T example)
Search for an existing model by a given (not saved) example model. Every modified attribute in this example is used as search parameter.- Type Parameters:
T- the type of the model and the type of the search result. Can be the same type or a subtype.- Parameters:
example- the example modelconv- the model converter- Returns:
- the search result as object(model)
- Throws:
ModelNotFoundException- if nothing was foundAmbiguousIdentifierException- if by the given searchparams to many models where found
-
getModelsByExample
<T> java.util.List<T> getModelsByExample(ModelConverter conv, T example)
Search for an existing models by a given (not saved) example model. Every modified attribute in this example is used as search parameter.- Type Parameters:
T- the type of the model and the type of the search result. Can be the same type or a subtype.- Parameters:
example- the example modelconv- the model converter- Returns:
- list containing zero or more models
- Throws:
ModelNotFoundException- if nothing was found
-
-