Use Case: You often have a case where you want to adaptTo from existing object to custom Object or Provide adapter functionality for custom object to existing object.
Solution: There are mainly two ways you can use adaptTo
Case 1: You want existing object to be adaptable to custom object. For example you have a specific kind of node and you want Node or Resource to be adaptable to this object.
CustomObject myCustomObject = resource.adaptTo(CustomObject.class)
CustomObject myCustomObject = node.adaptTo(CustomObject.class)
CustomObject myCustomObject = <ANY Adaptable OBJECT>.adaptTo(CustomObject.class)
Case 2: You want custom object to be adaptable to existing object. For example you have specific kind of resource and you want this to be adaptable to existing resource.
Node node = CustomObject.adaptTo(Node.class)
Resource resource = CustomObject.adaptTo(Resource.class)
<Any OOTB Adaptable> myObject = MycustomObject.adaptTo(<Any OOTB Adaptable>.class)
Case 1: Example