## org.eclipse.wst.ws.service.policy
Interface IPolicyState

    public interface IPolicyState

This interface is used by service policy extenders to save the state of there policies. Note: extenders do not need to worry about if these changes are committed or discarded. This is handled by the framework. For example if an extender makes a number of calls to the putValue method and at some point ServicePolicyPlatform.discard() is called, the framework will handle the discarding of the changes made by the putValue method calls. Note: this data will eventually be stored in Eclipse with the following key: servicePolicyId + "." + key where servicePolicyId is the unique id for this service policy and the key is the key specified in the putValue method.

Field Summary
`static java.lang.String` `DefaultValueKey`

Method Summary
`void` `addPolicyStateChangeListener(IPolicyStateChangeListener listener, boolean notifyOnlyOnCommit)` Adds a policy state change listener to this service policy.
`java.lang.String` `getValue(java.lang.String key)` This method gets some state for a service policy.
`boolean` `isMutable()` Returns whether the state of this policy is mutible or not.
`void` `putDefaultValue(java.lang.String key, java.lang.String defaultValue, boolean overrideExisting)` This method sets the default for a particular key.
`void` `putValue(java.lang.String key, java.lang.String value)` This method sets some state for a service policy.
`void` `removePolicyStateChangeListener(IPolicyStateChangeListener listener)` Removes a policy state change listener from this service policy.
`void` `setMutable(boolean mutable)`

Field Detail

### DefaultValueKey

    static final java.lang.String DefaultValueKey

See Also:
  Constant Field Values

Method Detail

### isMutable

    boolean isMutable()

  Returns whether the state of this policy is mutible or not.

  Returns:
    returns true if the state of this policy is mutable.

### setMutable

    void setMutable(boolean mutable)

  Parameters:
    `mutable` - sets whether this policy is mutable or not. Note: if the service policy for this IPolicyState object is predefined calling this method will have no effect.

### putValue

    void putValue(java.lang.String key,
                  java.lang.String value)

  This method sets some state for a service policy.

  Parameters:
    `key` - a key for this policy state.
    `value` - the value of the policy state.

### getValue

    java.lang.String getValue(java.lang.String key)

  This method gets some state for a service policy. If there is no persisted value for this key the default value will be returned. If there is no default value an empty string is returned.

  Parameters:
    `key` - a key for this service policy.
  Returns:
    returns the value for the key specified.

### putDefaultValue

    void putDefaultValue(java.lang.String key,
                         java.lang.String defaultValue,
                         boolean overrideExisting)

  This method sets the default for a particular key.

  Parameters:
    `key` - the key
    `defaultValue` - the default value.
    `overrideExisting` - indicates if a existing default value should be overridden.

### addPolicyStateChangeListener

    void addPolicyStateChangeListener(IPolicyStateChangeListener listener,
                                      boolean notifyOnlyOnCommit)

  Adds a policy state change listener to this service policy.

  Parameters:
    `listener` - the listener
    `notifyOnlyOnCommit` - indicates if this listener should be called for all state changes or only when the state data is committed.

### removePolicyStateChangeListener

    void removePolicyStateChangeListener(IPolicyStateChangeListener listener)

  Removes a policy state change listener from this service policy.

  Parameters:
    `listener` -