Don't allow null in BillingEvent.setFlags()

It's better that it always takes a non-null ImmutableSet, which may either be
empty or contain elements.  That way the ugliness of nullness is contained
just to the entity class itself, and all other code that interacts with it
can always be assured of having a real set to deal with.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=132066238
This commit is contained in:
mcilwain 2016-09-02 08:37:45 -07:00 committed by Ben McIlwain
parent c06133435b
commit 07135f6190
3 changed files with 9 additions and 3 deletions

View file

@ -157,7 +157,9 @@ public class DomainCreateFlow extends DomainCreateOrAllocateFlow {
.setBillingTime(now.plus(isAnchorTenant()
? registry.getAnchorTenantAddGracePeriodLength()
: registry.getAddGracePeriodLength()))
.setFlags(isAnchorTenant() ? ImmutableSet.of(BillingEvent.Flag.ANCHOR_TENANT) : null)
.setFlags(isAnchorTenant()
? ImmutableSet.of(BillingEvent.Flag.ANCHOR_TENANT)
: ImmutableSet.<BillingEvent.Flag>of())
.setParent(historyEntry)
.build();
ofy().save().entity(createEvent);