add typed id wrappers for safety in java

We've had a number of bugs related to getting the ids of different models confused. This gives java developers the option to use a type-safe id for their models to prevent mix ups.