alfresco-community-repo/source/java/org/alfresco/repo/avm/util/FileExtensionNameMatcher.java
Britt Park 8b65510d6f This checkin does two things:
1. Refines the semantics of ghost creation, so that they only appear when
warranted.
2. Implements a mechanism for filtering out files which should not appear in comparison
results or be pushed along by updates.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4525 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2006-12-05 22:26:02 +00:00

58 lines
1.2 KiB
Java

/**
*
*/
package org.alfresco.repo.avm.util;
import java.util.ArrayList;
import java.util.List;
import org.alfresco.util.NameMatcher;
/**
* NameMatcher that matches a list of extensions (case insensitively).
* @author britt
*/
public class FileExtensionNameMatcher implements NameMatcher
{
/**
* The extensions to match.
*/
private List<String> fExtensions;
/**
* Default constructor.
*/
public FileExtensionNameMatcher()
{
fExtensions = new ArrayList<String>();
}
/**
* Set the extensions case insensitively.
* @param extensions
*/
public void setExtensions(List<String> extensions)
{
for (String extension : extensions)
{
fExtensions.add(extension.toLowerCase());
}
}
/* (non-Javadoc)
* @see org.alfresco.util.NameMatcher#matches(java.lang.String)
*/
public boolean matches(String name)
{
String lcName = name.toLowerCase();
for (String ext : fExtensions)
{
if (lcName.endsWith(ext))
{
return true;
}
}
return false;
}
}