public interface Capable
Capabilities provide a mechanism for specific extensions to the API that do not break clients but may provide additional information on new (non-mandatory) aspects.
When building a new Capability, you should consider that it may not be recognized or used at all by existing consumers. This limits the use of this feature to non-critical stuff or to extended contracts targeting a specific consumer.
Consumers of a capability must be prepared to deal with he fact that the object may not implement it
Capabilities are used to provide a future-proof path to incorporate changes that may otherwise break backwards compatibility. New information can be provided in a new class exposed when specifically queried as a capability. Hence, clients that were not compiled with the new class in scope will not fail, and only clients aware of a specific capability will use it (that's the reason why there's no enumeration of capabilities in the interface)| Modifier and Type | Method and Description |
|---|---|
<T> Set<T> |
getCapabilities(Class<T> capabilityType)
Returns a
Set with the capabilities
which are an instance of the given capabilityType. |
boolean |
isCapableOf(Class<?> capabilityType)
Tells if this instance is capable of the given capability
|
<T> Set<T> getCapabilities(Class<T> capabilityType)
Set with the capabilities
which are an instance of the given capabilityType.
If no match is found, then an empty Set is
returnedcapabilityType - the capability to be obtained.Set. Might be empty but will never be nullboolean isCapableOf(Class<?> capabilityType)
capabilityType - a capability typeCopyright © 2015 MuleSoft, Inc.. All rights reserved.