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

## oracle.ifs.fdk.impl.ah
Class DirectAttributeHandler

    java.lang.Object
      oracle.ifs.fdk.impl.ah.DirectAttributeHandler

All Implemented Interfaces:
  AttributeHandler

    public class DirectAttributeHandler

extends java.lang.Object
implements AttributeHandler

Represents a simple attribute handler that directly maps an attribute name to a repository attribute name.

Constructor Summary
`DirectAttributeHandler(java.lang.String reposAttrName, java.lang.Class cls)` Constructor.
`DirectAttributeHandler(java.lang.String reposAttrName, java.lang.Class[] getFromClasses)` Constructor.
`DirectAttributeHandler(java.lang.String reposAttrName, java.lang.Class[] getFromClasses, java.util.Map classMap)` Constructor.
`DirectAttributeHandler(java.lang.String reposAttrName, java.lang.Class cls, java.util.Map classMap)` Constructor.

Method Summary
`boolean` | `canHandle(AttributeHandlerContext context)` Returns `true` if this handler can handle the attribute request on the given object instance.
`boolean` | `canUpdate(AttributeHandlerContext context)` Returns `true` if this handler can update the attribute, `false` if the attribute is not updateable.
`java.lang.String` | `getDefaultReposAttributeName()` Returns the default repository attribute name.
`java.lang.String` | `getReposAttributeName(java.lang.Class cls)` Returns the repository attribute name for the corresponding class as mapped by this attribute handler.
`java.lang.Object` | `getValue(AttributeHandlerContext context)` Returns the value of an attribute.
`boolean` | `isSimpleAttributeMap()` Returns true if the attribute map is null.
`AttributeUpdater` | `setValue(AttributeHandlerContext context, java.lang.Object value)` Updates the attribute with the given value.

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

Constructor Detail

### DirectAttributeHandler

    public DirectAttributeHandler(java.lang.String reposAttrName,
                                  java.lang.Class cls)

  Constructor. The attribute is read-only.

  Parameters:
    `reposAttrName` - The name of the attribute as defined on the repository object.
    `cls` - The top class type of the repository objects this handler can handle. Ttypically this is the first class in the hierarchy that defines the reposAttrName. It cannot be `null`.

### DirectAttributeHandler

    public DirectAttributeHandler(java.lang.String reposAttrName,
                                  java.lang.Class cls,
                                  java.util.Map classMap)

  Constructor. The attribute is read-only and it may be mapped to a repos attribute name based on the class of the repository object.

  Parameters:
    `reposAttrName` - The name of the attribute as defined on the repository object.
    `cls` - The top class type of the repository objects this handler can handle. Ttypically this is the first class in the hierarchy that defines the reposAttrName. It cannot be `null`.
    `classMap` - A map from .class to uppercased repository attribute name that allows various classes to map to an attribute other than the default `reposAttrName`.

### DirectAttributeHandler

    public DirectAttributeHandler(java.lang.String reposAttrName,
                                  java.lang.Class[] getFromClasses)

  Constructor.

  Parameters:
    `reposAttrName` - The name of the attribute as defined on the repository object.
    `getFromClasses` - List of classes this attribute can be retrieved from. This is useful if the attribute needs to be restricted to a subset of the class hierarchy. It cannot be `null`.

### DirectAttributeHandler

    public DirectAttributeHandler(java.lang.String reposAttrName,
                                  java.lang.Class[] getFromClasses,
                                  java.util.Map classMap)

  Constructor.

  Parameters:
    `reposAttrName` - The name of the attribute as defined on the repository object.
    `getFromClasses` - List of classes this attribute can be retrieved from. This is useful if the attribute needs to be restricted to a subset of the class hierarchy. It cannot be `null`.
    `classMap` - A map from .class to uppercased repository attribute name that allows various classes to map to an attribute other than the default `reposAttrName`.

Method Detail

### canHandle

    public boolean canHandle(AttributeHandlerContext context)

  Description copied from interface: `AttributeHandler`
  Returns `true` if this handler can handle the attribute request on the given object instance. The necessary information to determine which attribute is requested and what the underlying repository object is will be packaged in the context.

  Specified by:
    `canHandle` in interface `AttributeHandler`
  Parameters:
    `context` - The context when this handler is called.

### canUpdate

    public boolean canUpdate(AttributeHandlerContext context)

  Description copied from interface: `AttributeHandler`
  Returns `true` if this handler can update the attribute, `false` if the attribute is not updateable. The necessary information to determine which attribute is requested and what the underlying repository object is will be packaged in the context.

  Specified by:
    `canUpdate` in interface `AttributeHandler`
  Parameters:
    `context` - The context when this handler is called.

### getValue

    public java.lang.Object getValue(AttributeHandlerContext context)
                              throws IfsException

  Description copied from interface: `AttributeHandler`
  Returns the value of an attribute. This method must throw a `RuntimeException` if `canHandle()` returns `false` and this method is still being called.

  Note that implementations which handle read-only attributes should subclass `ReadOnlyAttributeHandler` for convenience as they would need to provide the read side methods only.

  Specified by:
    `getValue` in interface `AttributeHandler`
  Parameters:
    `context` - The context when this handler is called.
  Throws:
    `IfsException` - If a repository exception occurs.

### setValue

    public AttributeUpdater setValue(AttributeHandlerContext context,
                                     java.lang.Object value)
                              throws IfsException

  Description copied from interface: `AttributeHandler`
  Updates the attribute with the given value. This method must throw a `RuntimeException` if `canUpdate()` returns `false` and this method is still being called.

  An implementation of this method has two choices:

  1. If the update would result in a simple repository attribute update it must return an `AttributeUpdater` object filled in with the repositoy object to update, the name of the attribute and the value of the attribute (which may be a derived value from the value passed in). The driving code that invokes it will then do the actual update in an optimized way.
  2. The implementation may decide under special circumstances that it needs to do the update itself (because the logic is too complicated for the driving code to implement and it is a special case). In that case the return value must be `null` in order to notify the caller the update was executed.

  Specified by:
    `setValue` in interface `AttributeHandler`
  Parameters:
    `context` - The context when this handler is called.
    `value` - The value to set the attribute to.
  Throws:
    `IfsException` - If a repository exception occurs.

### isSimpleAttributeMap

    public boolean isSimpleAttributeMap()

  Description copied from class: `DirectAttributeHandler`
  Returns true if the attribute map is null.

### getDefaultReposAttributeName

    public java.lang.String getDefaultReposAttributeName()

  Description copied from class: `DirectAttributeHandler`
  Returns the default repository attribute name.

### getReposAttributeName

    public java.lang.String getReposAttributeName(java.lang.Class cls)

  Description copied from class: `DirectAttributeHandler`
  Returns the repository attribute name for the corresponding class as mapped by this attribute handler.

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