Class AdaptTo


  • @ProviderType
    public final class AdaptTo
    extends Object
    Utility methods around Sling Adaptable.
    • Method Detail

      • notNull

        @NotNull
        public static <T> T notNull​(@NotNull
                                    @NotNull org.apache.sling.api.adapter.Adaptable adaptable,
                                    @NotNull
                                    @NotNull Class<T> type)
        Try to adapt the adaptable to the given type and ensures that it succeeds.
        Type Parameters:
        T - Type
        Parameters:
        adaptable - Adaptable
        type - Type
        Returns:
        Adaption result (not null)
        Throws:
        UnableToAdaptException - if the adaption was not successful