class ConvertToMapAccessor implements Function<Object, YamlMapAccessor> {

    private final Supplier<? extends RuntimeException> supplier;

    /**
     * Constructor
     *
     * @param supplier supplier
     */
    public ConvertToMapAccessor(Supplier<? extends RuntimeException> supplier) {
        Precondition.notNull(supplier);
        this.supplier = supplier;
    }

    /**
     * Method to apply a function
     *
     * @param value value
     * @return the return value
     */
    @Override
    public YamlMapAccessor apply(Object value) {<FILL_FUNCTION_BODY>}
}

        try {
            return new YamlMapAccessor((Map<Object, Object>) value);
        } catch (ClassCastException e) {
            throw supplier.get();
        }
    
<no_super_class>