class ImmutablePolicy implements Policy {

    @Override
    public Policy setResourcesFor(final CharSequence label, final Resources resources) {
        final Label lbl = Label.of(label);
        checkNotNull(resources, "resources to set to the Policy entry");

        final Map<Label, PolicyEntry> entriesCopy = copyEntries();
        final PolicyEntry policyEntry = entriesCopy.get(lbl);
        final PolicyEntry modifiedEntry;
        if (null == policyEntry) {
            modifiedEntry = newPolicyEntry(lbl, PoliciesModelFactory.emptySubjects(), resources);
        } else {
            modifiedEntry = newPolicyEntry(lbl, policyEntry.getSubjects(), resources);
        }
        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);

}