Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

ObjectID Purpose

What is it for?

IObjectId Contract

For example:

TestEquivilence.java

IUserIdFactory userIdFactory = new UserIdFactoryImpl();
String id = "foo";

IUserId objId1 = userIdFactory.createUserId(id);
IUserId objId2 = userIdFactory.createUserId(id);
assertTrue(objId1.equals(objId2));
assertSame(objId1,objId2);

What about:

TestEquivilenceTwo.java
IUserIdFactory userIdFactory = new UserIdFactoryImpl();
IProfileIdFactory profileIdFactory = new ProfileIdFactoryImpl();

String id = "foo";

IUserId userId = userIdFactory.createUserId(id);
IProfileId profileId = profileIdFactory.createProfileId(id);
assertTrue(userId.equals(profileId));
assertSame(userId,profileId); // would this even be possible?

What does the IObjectId contract give us that equals() does not?
And can we create test cases to assert an implementations compliance to the contract?
Presumably there are cases where identity is a more complex thing than a String key.
Presumably there is a possibility for an object to want to operate on a collection of {{IObjectId}}s (say a cache).

ObjectID Refactoring

A picture of the IObjectId hierarchy prior to UPT-268 and after. IUserId is used as an illustrative example. The pattern is repeated for other I*Id interfaces.

  • No labels