|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openpermis.editor.policy.adapter.AbstractAdapter
public abstract class AbstractAdapter
Abstract base class of an adapter that uses a pico container to manage Adaptee
s.
The Adaptee
s are stored in a pico container with a string description key that
contains the (source) object type and the (target) adaptee type. Once an object should be
adapted a new adaptee is created using the pico container. All parameters necessary to
instantiate the adaptee are injected by the pico container, i.e. construction of the adaptee
is done using the source object.
Constructor Summary | |
---|---|
AbstractAdapter()
Creates an abstract adapter. |
Method Summary | ||
---|---|---|
|
adaptTo(Object object,
Class<T> adapteeType)
Adapts an object to the adaptee type. |
|
protected abstract org.picocontainer.MutablePicoContainer |
createContainer()
Creates and initializes the pico container used by this adapter. |
|
protected String |
getKey(Class<?> adapteeType,
Class<?> objectType)
Determines the unique key that identifies an adapter/object type pair. |
|
protected Class<?> |
getObjectType(Object object)
Determines the object type of the specified object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractAdapter()
The underlying pico container is initialized using createContainer()
.
Method Detail |
---|
protected abstract org.picocontainer.MutablePicoContainer createContainer()
Concrete implementations are expected to provide a fully configured pico here.
Adaptee
s should be registered at the pico with keys of the same type as
returned by getKey(Class, Class)
.
Adaptee
s.protected Class<?> getObjectType(Object object)
The default implementation returns the implementation class of the object.
object
- the object for which to determine the type in the context of this trader.
protected String getKey(Class<?> adapteeType, Class<?> objectType)
The key returned consists of the canonical adaptee type name followed by a colon and the canonical object type name.
Example: For adaptee type org.openpermis.policy.adapter.overview.Overview and object type org.openpermis.policy.Action the resulting string key will be org.openpermis.policy.adapter.overview.Overview:org.openpermis.policy.Action.
Note: Take care when dealing with object types that can be extended, always use interfaces or base types to identify an object type!
adapteeType
- the type of adapter for which to retrieve the key.objectType
- the object type for which to retrieve the key.
null
.public <T extends Adaptee<?>> T adaptTo(Object object, Class<T> adapteeType)
Adapter
adaptTo
in interface Adapter
object
- the object to adapt.adapteeType
- the type to adapt to.
|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
OpenPermis Role Based Access Control 0.9.0 (Build 16)
2009/08/13 07:17:21
Copyright (c) 2002-2007 Ergon Informatik AG