org.jboss.virtual.plugins.vfs.helpers
Class SuffixMatchFilter

java.lang.Object
  extended by org.jboss.virtual.plugins.vfs.helpers.AbstractVirtualFileFilterWithAttributes
      extended by org.jboss.virtual.plugins.vfs.helpers.SuffixMatchFilter
All Implemented Interfaces:
VirtualFileFilter, VirtualFileFilterWithAttributes

public class SuffixMatchFilter
extends AbstractVirtualFileFilterWithAttributes

Matches a file name against a list of suffixes.

Version:
$Revision: 44223 $
Author:
Scott.Stark@jboss.org, adrian@jboss.org

Constructor Summary
SuffixMatchFilter(Collection<String> suffixes)
          Create a new SuffixMatchFilter.
SuffixMatchFilter(Collection<String> suffixes, VisitorAttributes attributes)
          Create a new SuffixMatchFilter.
SuffixMatchFilter(String suffix)
          Create a new SuffixMatchFilter, using VisitorAttributes.DEFAULT
SuffixMatchFilter(String suffix, VisitorAttributes attributes)
          Create a new SuffixMatchFilter.
 
Method Summary
 boolean accepts(VirtualFile file)
          Accept any file that ends with one of the filter suffixes.
 
Methods inherited from class org.jboss.virtual.plugins.vfs.helpers.AbstractVirtualFileFilterWithAttributes
getAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SuffixMatchFilter

public SuffixMatchFilter(String suffix)
Create a new SuffixMatchFilter, using VisitorAttributes.DEFAULT

Parameters:
suffix - the suffix
Throws:
IllegalArgumentException - for a null suffix

SuffixMatchFilter

public SuffixMatchFilter(String suffix,
                         VisitorAttributes attributes)
Create a new SuffixMatchFilter.

Parameters:
suffix - the suffix
attributes - the attributes, pass null to use VisitorAttributes.DEFAULT
Throws:
IllegalArgumentException - for a null suffix

SuffixMatchFilter

public SuffixMatchFilter(Collection<String> suffixes)
Create a new SuffixMatchFilter.

Parameters:
suffixes - - the list of file suffixes to accept.
Throws:
IllegalArgumentException - for a null suffixes

SuffixMatchFilter

public SuffixMatchFilter(Collection<String> suffixes,
                         VisitorAttributes attributes)
Create a new SuffixMatchFilter.

Parameters:
suffixes - - the list of file suffixes to accept.
attributes - the attributes, pass null to use VisitorAttributes.DEFAULT
Throws:
IllegalArgumentException - for a null suffixes
Method Detail

accepts

public boolean accepts(VirtualFile file)
Accept any file that ends with one of the filter suffixes. This checks that the file.getName() endsWith a suffix.

Parameters:
file - the virtual file
Returns:
true if the file matches a suffix, false otherwise.


Copyright © 2009 JBoss, A division of Red Hat, Inc. All Rights Reserved.