Interface ModelSearchStrategy
- All Known Implementing Classes:
DefaultItemModelSearchStrategy
public interface ModelSearchStrategy
This interface describes strategy for searching model instances by example model. Currently only used in
Example:
ModelService.getByExample(Object).Example:
ProductModel exampleProduct = new ProductModel();
exampleProduct.setCode("test");
ModelConverter converter = defaultModelService.getModelConverterByModel(exampleProduct);
ProductModel foundProduct = defaultItemModelSearchStrategy.getModelByExample(converter,exampleProduct);
-
Method Summary
Modifier and TypeMethodDescription<T> TgetModelByExample(ModelConverter conv, T example) Search for an existing model by a given (not saved) example model.<T> List<T>getModelsByExample(ModelConverter conv, T example) Search for an existing models by a given (not saved) example model.
-
Method Details
-
getModelByExample
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
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
-