Sets the new policy.

@param policy
the new policy

@throws NullPointerException
if policy is {@code null}

@see UndoManagerPolicy
760071
public final void setUndoManagerPolicy(UndoManagerPolicy policy) throws NullPointerException {
		if (policy == null) {
			throw new NullPointerException("The policy must not be null.");
		}
		
		if (this.policy == policy) {
			return;
		}

		final UndoManagerPolicy oldPolicy = this.policy;
		this.policy = policy;
		
		if (oldPolicy == UndoManagerPolicy.DEFAULT) {
			this.textComponent.removePropertyChangeListener("editable", this);
			this.textComponent.removePropertyChangeListener("enabled", this);
		}

		if (this.policy == UndoManagerPolicy.DEFAULT) {
			this.textComponent.addPropertyChangeListener("editable", this);
			this.textComponent.addPropertyChangeListener("enabled", this);
		}

		handleUndoManagerPolicy();
	}
1168344
public function setPolicy(string $policy = null): void
    {
        if (null == $policy) {
            unset($this->attributes['Policy']);
        } else {
            $this->attributes['Policy'] = $policy;
        }
    }
1132029
public final void setVisibilityPolicy(@NonNull VisibilityPolicy visibilityPolicy) {
        checkNotNull(visibilityPolicy, "visibilityPolicy");
        if (visibilityPolicy != mVisibilityPolicy) {
            mVisibilityPolicy = visibilityPolicy;
            updateViews();
        }
    }
238675
def apply_policy(self, sp_entity_id, policy, metadata=None):
        

        policy.acs = self.acs
        ava = policy.restrict(self, sp_entity_id, metadata)

        for key, val in list(self.items()):
            if key in ava:
                self[key] = ava[key]
            else:
                del self[key]

        return ava
911520
public void setAuthorizationPersistencePolicy(PersistencePolicy policy) {
        if (policy == null) {
            throw new IllegalArgumentException("The policy argument cannot be null");
        }

        if (preferences.persistencePolicy.get() != policy) {
            preferences.persistencePolicy.set(policy);

            preferences.accessToken.updateStateByPolicy();
            preferences.idToken.updateStateByPolicy();
        }
    }
340204
public void setPolicyIds(java.util.Collection<String> policyIds) {
        if (policyIds == null) {
            this.policyIds = null;
            return;
        }

        this.policyIds = new java.util.ArrayList<String>(policyIds);
    }
741074
public void loadLibrary(Class<?> clazz, String name, LoadPolicy policy) {
        if (loaded.contains(name)) {
            return;
        }

        switch (policy) {
            case PREFER_SHIPPED:
                try {
                    loadShippedLibrary(clazz, name);
                } catch (LoadLibraryException ex) {
                    try {
                        loadSystemLibrary(name);
                    } catch (LoadLibraryException ex2) {
                        throw ex;
                    }
                }
                break;
            case PREFER_SYSTEM:
                try {
                    loadSystemLibrary(name);
                } catch (LoadLibraryException ex) {
                    try {
                        loadShippedLibrary(clazz, name);
                    } catch (LoadLibraryException ex2) {
                        throw ex;
                    }
                }
                break;
            case SHIPPED_ONLY:
                loadShippedLibrary(clazz, name);
                break;
            case SYSTEM_ONLY:
                loadSystemLibrary(name);
                break;
            default:
                throw new IllegalStateException("Unknown policy " + policy);
        }

        loaded.add(name);
    }
1365351
public void setChaincodeEndorsementPolicy(LifecycleChaincodeEndorsementPolicy chaincodeEndorsementPolicy) throws InvalidArgumentException {
        if (null == chaincodeEndorsementPolicy) {
            throw new InvalidArgumentException(" The parameter chaincodeEndorsementPolicy may not be null.");
        }
        validationParameter = chaincodeEndorsementPolicy.getByteString();
    }
506670
public static Set<Policy> policies(Config config, EvictionPolicy policy) {
    BasicSettings settings = new BasicSettings(config);
    return settings.admission().stream().map(admission ->
      new FrequentlyUsedPolicy(admission, policy, config)
    ).collect(toSet());
  }
1350067
public void setPolicyVersions(java.util.Collection<PolicyVersion> policyVersions) {
        if (policyVersions == null) {
            this.policyVersions = null;
            return;
        }

        this.policyVersions = new java.util.ArrayList<PolicyVersion>(policyVersions);
    }
1234127
public static function setIoErrorPolicy($policy)
    {
        if (!in_array($policy, self::$policyMap, true)) {
            throw new LoggerConfigurationException("Policy '{$policy}' not found");
        }
        self::$ioErrorPolicy = $policy;
    }
874821
public final void setUsagePolicy(Callback<Integer, Usage> policy) {
        Objects.requireNonNull(policy);
        this.usagePolicy.set(policy);
    }
1064933
public final void setEntryEditPolicy(Callback<EntryEditParameter, Boolean> policy) {
        Objects.requireNonNull(policy, "The edit entry policy can not be null");
        this.entryEditPolicy.set(policy);
    }
658057
public void setChaincodeEndorsementPolicy(LifecycleChaincodeEndorsementPolicy lifecycleChaincodeEndorsementPolicy) throws InvalidArgumentException {
        if (null == lifecycleChaincodeEndorsementPolicy) {
            throw new InvalidArgumentException("The parameter lifecycleChaincodeEndorsementPolicy may not be null.");
        }
        this.validationParameter = lifecycleChaincodeEndorsementPolicy.getByteString();
    }
74822
public void setSecurityPolicy(com.google.api.ads.admanager.axis.v201805.SecurityPolicySettings securityPolicy) {
        this.securityPolicy = securityPolicy;
    }
1241736
@Override
    public String addPolicy(String name, String document)
    throws PolicyIndexException {
        writeLock.lock();
        try {
            logger.debug("Adding policy named: " + name);
            return doAdd(name, document);
        } finally {
            writeLock.unlock();
        }
    }
1178262
public void reloadPolicies(String scanPolicyName) {
        DefaultComboBoxModel<String> policies = new DefaultComboBoxModel<>();
        for (String policy : extension.getPolicyManager().getAllPolicyNames()) {
            policies.addElement(policy);
        }
        getPolicySelector().setModel(policies);
        getPolicySelector().setSelectedItem(scanPolicyName);
    }