-
Notifications
You must be signed in to change notification settings - Fork 263
General Adaptation Interfaces
The namespace Sce.Atf.Adaptation
contains several general purpose, simple interfaces for adaptation. These interfaces are implemented by classes that want to have adapters or be adapters.
IAdaptable
is implemented by every class that wants to be adaptable, that is, have adapters to extend its reach. Its method comes right to the point:
object GetAdapter(Type type);
This method returns the adapter for the given type. Note that the object returned is of the type specified, so by definition, it provides the desired interface for its type. Only one adapter is returned. The IDecoratable
interface can be used to get a collection of adapters. Also, the Adapters.AsAll()
method returns all adapters for a type. For information on this class, see Adapters Class.
This interface's job is to get all decorators for a type:
IEnumerable<object> GetDecorators(Type type);
In this case, decorator means adapter, so this method returns all adapters of the given type. IDecoratable
complements IAdaptable
, whose GetAdapter()
returns a single adapter.
IAdapter
is implemented by adapters, which adapt an adaptee. IAdapter
's declaration indicates it implements two other interfaces:
public interface IAdapter : IAdaptable, IDecoratable
That this interface also implements IAdaptable
underscores the fact that an adapter is also an adaptee. Its one property, Adaptee
, gets and sets the adaptee for the adapter.
The Adapter
class implements IAdapter
.
IAdapterCreator
works for adapter creators and is used to build adapter factories with its methods:
-
bool CanAdapt(object adaptee, Type type)
: can an adapter of the desired type be created for this potential adaptee? -
object GetAdapter(object adaptee, Type type)
: get an adapter of the given type for the adaptee ornull
if none is available.
AdapterCreator
class implements IAdapterCreator
. AdapterCreator
can be used to make property editors show the attributes listed in property descriptor definitions. For more information, see Metadata Driven Property Editing.
The class Sce.Atf.Dom.TypeAdapterCreator<T>
implements IAdapterCreator
for DomNode
s.
IAdapterCreator
is also used in making lists of DOM adapters for each DomNodeType
. For this discussion, see Adapting to All Available Interfaces.
- What is Adaptation: General discussion of what adaptation is and how it is used in ATF.
- General Adaptation Interfaces: Survey of interfaces for adaptation.
- General Adaptation Classes: Describe fundamental classes in adaptation.
- Control Adapters: Discussion of control adapters, which add abilities to controls without changing the control.
- Other Adaptation Classes: Survey of non-control adapter classes that perform various kinds of adaptation.
- Adapting to All Available Interfaces: A detailed example of how adaptation works and what you need to do to make it work showing how adapters can be obtained for any interface DOM adapters implement.
- Home
- Getting Started
- Features & Benefits
- Requirements & Dependencies
- Gallery
- Technology & Samples
- Adoption
- News
- Release Notes
- ATF Community
- Searching Documentation
- Using Documentation
- Videos
- Tutorials
- How To
- Programmer's Guide
- Reference
- Code Samples
- Documentation Files
© 2014-2015, Sony Computer Entertainment America LLC