Interface Specializable<S>

    • Method Detail

      • as

        default <T extends SOptional<T> as​(Class<T> type)
        Get this instance as a desired subtype.

        If the instance is not castable to the specified type, the Optional will be empty.

        Type Parameters:
        T - The desired type.
        Parameters:
        type - The type as which to obtain this instance.
        Returns:
        Returns an Optional of this instance if it could be cast, otherwise an empty result.
        Throws:
        NullPointerException - If the type is null.