@ConsumerType
public interface Adaptable
Adaptable
interface identifies objects which can be adapted
to other types or representations of the same object. For example a JCR Node
based Resource
can adapt to the
underlying JCR Node or a file based resource could adapt to the underlying
java.io.File
.Modifier and Type | Method and Description |
---|---|
<AdapterType> |
adaptTo(Class<AdapterType> type)
Adapts the adaptable to another type.
|
@CheckForNull <AdapterType> AdapterType adaptTo(@Nonnull Class<AdapterType> type)
Please not that it is explicitly left as an implementation detail whether
each call to this method with the same type
yields the same
object or a new object on each call.
Implementations of this method should document their adapted types as well as their behaviour with respect to returning newly created or not instance on each call.
AdapterType
- The generic type to which this resource is adapted
totype
- The Class object of the target type, such as
javax.jcr.Node.class
or
java.io.File.class
null
if the resource cannot
adapt to the requested typeCopyright © 2015 The Apache Software Foundation. All rights reserved.