Closed n0rmzzz closed 6 years ago
Merging #85 into master will not change coverage. The diff coverage is
n/a
.
@@ Coverage Diff @@
## master #85 +/- ##
=======================================
Coverage 81% 81%
Complexity 2682 2682
=======================================
Files 211 211
Lines 8305 8305
Branches 1207 1207
=======================================
Hits 6747 6747
Misses 1361 1361
Partials 197 197
I made the constructors private because I wanted these Type classes to act like enums when it comes to testing for equality. If users were given access to the constructors, then it wouldn't work.
To create your own type object, call the get()
method like so:
AddressType vacation1 = AddressType.get("VACATION");
It will see that no type object exists with that value, so it will create one (it does not return null like you might think).
If the same method call is made a second time, it will return the same object instance:
AddressType vacation2 = AddressType.get("VACATION");
assertTrue(vacation1 == vacation2);
Makes sense, thanks for the explanation.
Now you can't convert to and from contact managers that allow custom labels (in addition to home, work, etc) for contact methods. If we allow extending type classes, like EmailType, there will be a way to construct these for the custom types.