package com.srbenoit.xml;

import java.io.File;
import javax.swing.filechooser.FileFilter;

/**
 * A filter to limit file views to only files with ".xml" extensions (not case sensitive).
 */
public class XmlFileFilter extends FileFilter implements java.io.FileFilter {

    /**
     * Tests whether or not the specified abstract pathname should be included in a pathname list.
     *
     * @param   pathname  The abstract pathname to be tested
     * @return  <code>true</code> if and only if <code>pathname</code> should be included
     */
    @Override public boolean accept(final File pathname) {

        return pathname.getName().toLowerCase().endsWith(".xml");
    }

    /**
     * Gets the description of this filter.
     *
     * @return  the description
     */
    @Override public String getDescription() {

        return "XML files (.xml)";
    }
}
