class ImmutablePolicy implements Policy {

    @Override
    public Policy setSubjectsFor(final CharSequence label, final Subjects subjects) {
        final Label lbl = Label.of(label);
        checkNotNull(subjects, "subjects to set to the Policy entry");

        final Map<Label, PolicyEntry> entriesCopy = copyEntries();
        final PolicyEntry modifiedEntry;

        if (!entriesCopy.containsKey(lbl)) {
            modifiedEntry = newPolicyEntry(lbl, subjects, emptyResources());
        } else {
            final PolicyEntry policyEntry = entriesCopy.get(lbl);
            modifiedEntry = newPolicyEntry(lbl, subjects, policyEntry.getResources());
        }

        entriesCopy.put(lbl, modifiedEntry);
        return new ImmutablePolicy(policyId, entriesCopy, lifecycle, revision, modified, created);
    }

    private  ImmutablePolicy(@Nullable final PolicyId policyId,
            final Map<Label, PolicyEntry> theEntries,
            @Nullable final PolicyLifecycle lifecycle,
            @Nullable final PolicyRevision revision,
            @Nullable final Instant modified,
            @Nullable final Instant created);

}