I am developing an API. Here are some examples from the interface:
Entry findEntry(int processId); Entry findEntry(int processId, Filter filter);
where processId refers to some unique identifying information. However, I do not know what type processId .
How to abstract from an element like id of something?
The best I could come up with was to create a dummy interface:
Entry findEntry(ProcessId id); Entry findEntry(ProcessId, Filter filter);
However, I am worried that with the above approach, I can get the API client to run at a very high level of abstraction. For example, equality of the process identifier will no longer work (whereas if they used int-it).
Clarification: I was unable to clarify that I am writing only interfaces (contracts) that will be implemented later, possibly by another team. That is why I cannot force certain things, such as the equals method.
source share