-
Notifications
You must be signed in to change notification settings - Fork 263
What is Adaptation
Adaptation is the process of allowing an object of one type to behave like another type. This means the object can use the API of another type: its methods, properties, and events—with its own data. You can think of adaptation as dynamic casting. However, ATF's adaptation goes beyond casting like the C# as
operator does, because type compatibility is not required. In addition, if casting fails, adaptation looks for an object that performs the adaptation. For more details, see As Methods.
An adapter for an object A
to type T
is an object that has all the behavior and data of A
and also behaves like an object of type T
. In this case, A
is the adaptee of the adapter. An object can be its own adapter.
Adapters implement the IAdapter
interface. Adaptees implement the IAdaptable
interface, which obtains an adapter for a given type.
Adaptation is a powerful tool used widely in ATF. Adaptation gives you the ability to extend the behavior of objects without using inheritance. To add new functionality to an object's class, you don't need to make it implement an interface or derive from another class: simply add an adapter with the new capabilities.
DOM adapters that adapt DomNode
s are one of the most important kinds of adapters. For more information, see the ATF Programmer’s Guide: Document Object Model (DOM), which you can download at ATF Documentation.
You can also use adaptation with controls. AdaptableControl
, and its Direct2D version D2dAdaptableControl
, are base controls that can take control adapters. Classes that derive from ControlAdapter
add new functions to controls without changing the controls. ATF has a large set of ControlAdapter
classes, and you can create your own by deriving from ControlAdapter
or one of its ancestors.
The Adaptation Framework's interfaces and classes are in two namespaces:
-
Sce.Atf.Adaptation
: contains general interfaces and classes. -
Sce.Atf.Controls.Adaptable
: has the interfaces and classes for control adapters.
- 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