I am creating a API for DB access.
Already there is one application using our API.In this case if I want to change the type of parameter from interface to the implementing type.
For example,
API version 1.0:
getDomain1Data(SearchBy searchBy,List<String> someList);
Can i change this to the below ? I want to ensure that the API user does not search domain1
data with another domain's table column name.
getDomain1Data(Domain1SearchBy searchBy,List<String> someList);
If I do this should I add deprecated to the first method and then add the second method or I can just replace the first method with the second one.
Thanks.
If there is already a app which uses your interface method it would be unwise to delete previous method. I would rather add
getDomain1Data(Domain1SearchBy searchBy,List<String> someList);
and add@Deprecated
annotation to the previous one.Sample code:
Result: