Package io.wcm.sling.commons.adapter
Class AdaptTo
- java.lang.Object
-
- io.wcm.sling.commons.adapter.AdaptTo
-
@ProviderType public final class AdaptTo extends java.lang.Object
Utility methods around SlingAdaptable
.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> T
notNull(@NotNull org.apache.sling.api.adapter.Adaptable adaptable, @NotNull java.lang.Class<T> type)
Try to adapt the adaptable to the given type and ensures that it succeeds.
-
-
-
Method Detail
-
notNull
@NotNull public static <T> T notNull(@NotNull @NotNull org.apache.sling.api.adapter.Adaptable adaptable, @NotNull @NotNull java.lang.Class<T> type)
Try to adapt the adaptable to the given type and ensures that it succeeds.- Type Parameters:
T
- Type- Parameters:
adaptable
- Adaptabletype
- Type- Returns:
- Adaption result (not null)
- Throws:
UnableToAdaptException
- if the adaption was not successful
-
-