Overview | Package | Class | Tree | Deprecated | Index | Help
| OracleAS PDK for Java 9.0.4.0.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.portal.provider.v2.preference
Class Preference

    java.lang.Object
      |
      +--oracle.portal.provider.v2.preference.Preference

public final class Preference
extends java.lang.Object

A `Preference` is the 'key' through which `PreferenceDataObject`s are stored and retrieved from a `PreferenceStore`. The main component of this key is the reference path. A reference path is a string consisting of zero or more path components, each delimited by a `'/'` character. A path component is a string of one or more unicode characters, not including the `'/'` character. It is illegal for a path component to be equal to the strings `"."` or `".."`.

The idea is that a data item associated with a particular application object is stored under a reference path composed from a 'context' reference path which uniquely identifies the object within the context of its 'parent' objects, appended with a path component which uniquely identifies the data item. An example form of reference path corresponding to user-specific data associated with a portlet instance might be `"<provider id>/<portlet id>/<portlet instance name>/<user name>"`.

To prevent one reference path naming scheme from 'clashing' with another in the preference store, the `Preference` key contains an additional preference type component, which should group together all reference paths of the same 'type'. A naming scheme similar to the one used for Java package names should be used to ensure uniqueness of path types, e.g. `"oracle.portal.provider.v2.user"`.

The final component of the `Preference` key is the class name of the `PreferenceDataObject` to be stored or retrieved. This component is only mandatory if the `Preference` is to be read from storage, as it can be automatically determined for data objects provided for writing to storage.

Constructor Summary
`Preference(java.lang.String referencePath, java.lang.String type, PreferenceDataObject data)` Constructs a `Preference` for writing the given data object.
`Preference(java.lang.String referencePath, java.lang.String type, java.lang.String dataClassName)` Constructs a `Preference` for reading data with the given class.
`Preference(java.lang.String contextPath, java.lang.String name, java.lang.String type, PreferenceDataObject data)` Constructs a `Preference` for writing the given data object.
`Preference(java.lang.String contextPath, java.lang.String name, java.lang.String type, java.lang.String dataClassName)` Constructs a `Preference` for reading data with the given class.

Method Summary
`java.lang.String` | `getContextPath()` Gets the context path of this `Preference`.
`PreferenceDataObject` | `getData()` Get the data object associated with this `Preference`.
`java.lang.Class` | `getDataClass()` Gets the `Class` object representing the class of the `PreferenceDataObject` stored against this preference.
`java.lang.String` | `getDataClassName()` Gets the full class name of the `PreferenceDataObject` stored against this preference.
`java.lang.String` | `getName()` Gets the name which identifies this `Preference` within its context path.
`java.lang.String` | `getReferencePath()` Gets the full reference path of this `Preference`, consisting of a a context path followed by a unique name.
`java.lang.String` | `getType()` Gets the preference type.
`void` | `setData(PreferenceDataObject dataObject)` Sets the data object to be stored under this `Preference`.
`void` | `setDataClass(java.lang.Class dataClass)` Sets the `Class` object representing the class of the `PreferenceDataObject` to be loaded into this `Preference`.
`void` | `setDataClass(java.lang.String dataClassName)` Sets the full class name of the `PreferenceDataObject` to be loaded into this `Preference`.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Preference

    public Preference(java.lang.String contextPath,
                      java.lang.String name,
                      java.lang.String type,
                      java.lang.String dataClassName)
               throws PreferenceStoreException

  Constructs a `Preference` for reading data with the given class.

Parameters:
  `contextPath` - the context path of this `Preference`.
  `name` - the name which identifies the preference within the context path.
  `type` - the preference type. Should be a String name which follows the conventions for naming Java packages, e.g. `"oracle.portal.provider.v2.user"`.
  `dataClassName` - the full class name of the `PreferenceDataObject` stored under this `Preference`.

### Preference

    public Preference(java.lang.String referencePath,
                      java.lang.String type,
                      java.lang.String dataClassName)
               throws PreferenceStoreException

  Constructs a `Preference` for reading data with the given class.

Parameters:
  `referencePath` - the full reference path of this `Preference`, including a context path followed by a unique name.
  `type` - the preference type. Should be a String name which follows the conventions for naming Java packages, e.g. `"oracle.portal.provider.v2.user"`.
  `dataClassName` - the full class name of the `PreferenceDataObject` stored under this `Preference`.

### Preference

    public Preference(java.lang.String contextPath,
                      java.lang.String name,
                      java.lang.String type,
                      PreferenceDataObject data)
               throws PreferenceStoreException

  Constructs a `Preference` for writing the given data object.

Parameters:
  `contextPath` - the context path of this `Preference`.
  `name` - the name which identifies the preference within the context path.
  `type` - the preference type. Should be a String name which follows the conventions for naming Java packages, e.g. `"oracle.portal.provider.v2.user"`.
  `data` - the data object to be stored.

### Preference

    public Preference(java.lang.String referencePath,
                      java.lang.String type,
                      PreferenceDataObject data)
               throws PreferenceStoreException

  Constructs a `Preference` for writing the given data object.

Parameters:
  `referencePath` - the full reference path of this `Preference`, including a context path followed by a unique name.
  `type` - the preference type. Should be a String name which follows the conventions for naming Java packages, e.g. `"oracle.portal.provider.v2.user"`.
  `data` - the data object to be stored.

Method Detail

### getReferencePath

    public java.lang.String getReferencePath()

  Gets the full reference path of this `Preference`, consisting of a a context path followed by a unique name.

  Returns:
    the full reference path of this `Preference`

### getName

    public java.lang.String getName()

  Gets the name which identifies this `Preference` within its context path.

  Returns:
    the name which identifies this `Preference` within its context path.

### getContextPath

    public java.lang.String getContextPath()

  Gets the context path of this `Preference`.

  Returns:
    the context path of this `Preference`

### getType

    public java.lang.String getType()

  Gets the preference type.

  Returns:
    the preference type. Should be a String name which follows the conventions for naming Java packages, e.g. `"oracle.portal.provider.v2.user"`.

### getDataClassName

    public java.lang.String getDataClassName()

  Gets the full class name of the `PreferenceDataObject` stored against this preference.

  Returns:
    the full class name of the `PreferenceDataObject` stored against this preference, if known, or `null` otherwise.

### getDataClass

    public java.lang.Class getDataClass()
                                 throws PreferenceStoreException

  Gets the `Class` object representing the class of the `PreferenceDataObject` stored against this preference.

  Returns:
    `Class` object representing the class of the `PreferenceDataObject` stored against this preference, if known, or `null` otherwise.
  Throws:
    `PreferenceStoreException` - if the class is unknown, or cannot be loaded.

### getData

    public PreferenceDataObject getData()

  Get the data object associated with this `Preference`. The `Preference`'s data object must have been supplied during construction or loaded using `PreferenceStore.read(oracle.portal.provider.v2.preference.Preference)` for this method to return a non-null value.

  Returns:
    the data object associated with this `Preference`, or `null` if one hasn't yet been loaded.

### setDataClass

    public void setDataClass(java.lang.String dataClassName)
                      throws PreferenceStoreException

  Sets the full class name of the `PreferenceDataObject` to be loaded into this `Preference`. Note that if a data object is currently held in this `Preference`, this will remove it as a side effect. Note also that if the named class cannot be loaded, this will not cause an exception, as it will still be possible to read the data as an input stream using `PreferenceStore.getInputStream(oracle.portal.provider.v2.preference.Preference)`.

  Parameters:
    `dataClassName` - the full class name of the `PreferenceDataObject` to be loaded into this `Preference`.
  Throws:
    `PreferenceStoreException` - if the class is not a subclass of `PreferenceDataObject`.

### setDataClass

    public void setDataClass(java.lang.Class dataClass)
                      throws PreferenceStoreException

  Sets the `Class` object representing the class of the `PreferenceDataObject` to be loaded into this `Preference`. Note that if a data object is currently held in this `Preference`, this will remove it as a side effect.

  Throws:
    `PreferenceStoreException` - if the class is not a subclass of `PreferenceDataObject`.

### setData

    public void setData(PreferenceDataObject dataObject)
                 throws PreferenceStoreException

  Sets the data object to be stored under this `Preference`.

  Parameters:
    `dataObject` - the data object to be stored under this `Preference`.
    `PreferenceStoreException`

Overview | Package | Class | Tree | Deprecated | Index | Help
| OracleAS PDK for Java 9.0.4.0.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2002,2003 Oracle Corporation. All Rights Reserved.