|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.cdmckay.coffeedom.filter.AbstractFilter org.cdmckay.coffeedom.filter.ContentFilter
public class ContentFilter
A general purpose Filter able to represent all legal CoffeeDOM objects or a specific subset. Filtering is accomplished by way of a filtering enum set in which each enum constant represents whether a CoffeeDOM object is visible or not. For example to view all Text and CDATA nodes in the content of element x.
Filter filter = new ContentFilter(EnumSet.of(ContentType.Text, ContentType.CDATA));
List<Content> content = x.getContents(filter);
The default is to allow all valid CoffeeDOM objects.
Nested Class Summary | |
---|---|
static class |
ContentFilter.ContentType
|
Constructor Summary | |
---|---|
ContentFilter()
Default constructor that allows any legal CoffeeDOM objects. |
|
ContentFilter(boolean allVisible)
Set whether all CoffeeDOM objects are visible or not. |
|
ContentFilter(EnumSet<ContentFilter.ContentType> set)
Filter out CoffeeDOM objects according to a filtering set. |
Method Summary | |
---|---|
boolean |
equals(Object object)
Returns whether the two filters are equivalent (i.e. the matching mask values are identical). |
void |
filterDocumentContent()
Set filter to match only CoffeeDOM objects that are legal document content. |
void |
filterElementContent()
Set filter to match only CoffeeDOM objects that are legal element content. |
EnumSet<ContentFilter.ContentType> |
getFilterSet()
Return current filtering set. |
int |
hashCode()
|
boolean |
matches(Object object)
Check to see if the object matches according to the filter mask. |
void |
resetFilterSet()
Reset this filter to allow all legal CoffeeDOM objects. |
void |
setFilterSet(EnumSet<ContentFilter.ContentType> set)
Set filtering set. |
Methods inherited from class org.cdmckay.coffeedom.filter.AbstractFilter |
---|
and, negate, or |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ContentFilter()
public ContentFilter(boolean allVisible)
allVisible
- true
all CoffeeDOM objects are visible, false
all CoffeeDOM objects are
hidden.public ContentFilter(EnumSet<ContentFilter.ContentType> set)
set
- Set of CoffeeDOM content types to allow.Method Detail |
---|
public EnumSet<ContentFilter.ContentType> getFilterSet()
public void setFilterSet(EnumSet<ContentFilter.ContentType> set)
set
- the new filtering setpublic void resetFilterSet()
public void filterDocumentContent()
public void filterElementContent()
public boolean matches(Object object)
object
- The object to verify.
true
if the objected matched a predfined set of rules.public boolean equals(Object object)
equals
in class Object
object
- the object to compare against
public int hashCode()
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |