JDOM
2.0.5

org.jdom2.filter
Class Filters

java.lang.Object
  extended by org.jdom2.filter.Filters

public final class Filters
extends java.lang.Object

Factory class of convenience methods to create Filter instances of common types. Methods that return Filters that act on core JDOM classes (Element, Text, etc.) are simply named after the content they return.

Filters that match non-core classes (Boolean, Object, etc.) are all prefixed with the letter 'f' (for filter).

The Filter returned by fpassthrough() is not really a filter in the sense that it will never filter anything out - everything matches. This can be useful to accomplish some tasks, for example the JDOM XPath API uses it extensively.

Author:
Rolf Lear

Method Summary
static Filter<Attribute> attribute()
          Return a Filter that matches any Attribute data.
static Filter<Attribute> attribute(Namespace ns)
          Return a Filter that matches any Attribute data with the specified namespace.
static Filter<Attribute> attribute(java.lang.String name)
          Return a Filter that matches any Attribute data with the specified name.
static Filter<Attribute> attribute(java.lang.String name, Namespace ns)
          Return a Filter that matches any Attribute data with the specified name and namespace.
static Filter<CDATA> cdata()
          Return a Filter that matches any CDATA data.
static Filter<Comment> comment()
          Return a Filter that matches any Comment data.
static Filter<Content> content()
          Return a Filter that matches any Content data.
static Filter<DocType> doctype()
          Return a Filter that matches any DocType data.
static Filter<Document> document()
          Return a Filter that matches any Document data.
static Filter<Element> element()
          Return a Filter that matches any Element data.
static Filter<Element> element(Namespace ns)
          Return a Filter that matches any Element data with the specified Namespace.
static Filter<Element> element(java.lang.String name)
          Return a Filter that matches any Element data with the specified name.
static Filter<Element> element(java.lang.String name, Namespace ns)
          Return a Filter that matches any Element data with the specified name and Namespace.
static Filter<EntityRef> entityref()
          Return a Filter that matches any EntityRef data.
static Filter<java.lang.Boolean> fboolean()
          Return a Filter that matches any Boolean data.
static
<F> Filter<F>
fclass(java.lang.Class<F> clazz)
          Return a Filter that matches any data of the specified Class.
static Filter<java.lang.Double> fdouble()
          Return a Filter that matches any Double data.
static Filter<java.lang.Object> fpassthrough()
          Return a filter that does no filtering at all - everything matches.
static Filter<java.lang.String> fstring()
          Return a Filter that matches any String data.
static Filter<ProcessingInstruction> processinginstruction()
          Return a Filter that matches any ProcessingInstruction data.
static Filter<Text> text()
          Return a Filter that matches any Text data (which includes CDATA since that is a subclass of Text).
static Filter<Text> textOnly()
          Return a Filter that matches any Text data (excludes CDATA instances).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

content

public static final Filter<Content> content()
Return a Filter that matches any Content data.

Returns:
a Filter that matches any Content data.

attribute

public static final Filter<Attribute> attribute()
Return a Filter that matches any Attribute data.

Returns:
a Filter that matches any Attribute data.

attribute

public static final Filter<Attribute> attribute(java.lang.String name)
Return a Filter that matches any Attribute data with the specified name.

Parameters:
name - The name for all the Attributes to have (these can be in any Namespace).
Returns:
a Filter that matches any Attribute data with the specified name.

attribute

public static final Filter<Attribute> attribute(java.lang.String name,
                                                Namespace ns)
Return a Filter that matches any Attribute data with the specified name and namespace.

Parameters:
name - The name for all the Attributes to have.
ns - The Namespace for all the Attributes to have.
Returns:
a Filter that matches any Attribute data with the specified name and namespace.

attribute

public static final Filter<Attribute> attribute(Namespace ns)
Return a Filter that matches any Attribute data with the specified namespace.

Parameters:
ns - The Namespace for all the Attributes to have.
Returns:
a Filter that matches any Attribute data with the specified namespace.

comment

public static final Filter<Comment> comment()
Return a Filter that matches any Comment data.

Returns:
a Filter that matches any Comment data.

cdata

public static final Filter<CDATA> cdata()
Return a Filter that matches any CDATA data.

Returns:
a Filter that matches any CDATA data.

doctype

public static final Filter<DocType> doctype()
Return a Filter that matches any DocType data.

Returns:
a Filter that matches any DocType data.

entityref

public static final Filter<EntityRef> entityref()
Return a Filter that matches any EntityRef data.

Returns:
a Filter that matches any EntityRef data.

element

public static final Filter<Element> element()
Return a Filter that matches any Element data.

Returns:
a Filter that matches any Element data.

document

public static final Filter<Document> document()
Return a Filter that matches any Document data.

Returns:
a Filter that matches any Document data.

element

public static final Filter<Element> element(java.lang.String name)
Return a Filter that matches any Element data with the specified name.

Parameters:
name - The name of Elements to match.
Returns:
a Filter that matches any Element data with the specified name.

element

public static final Filter<Element> element(java.lang.String name,
                                            Namespace ns)
Return a Filter that matches any Element data with the specified name and Namespace.

Parameters:
name - The name of Elements to match.
ns - The Namespace to match
Returns:
a Filter that matches any Element data with the specified name and Namespace.

element

public static final Filter<Element> element(Namespace ns)
Return a Filter that matches any Element data with the specified Namespace.

Parameters:
ns - The Namespace to match
Returns:
a Filter that matches any Element data with the specified Namespace.

processinginstruction

public static final Filter<ProcessingInstruction> processinginstruction()
Return a Filter that matches any ProcessingInstruction data.

Returns:
a Filter that matches any ProcessingInstruction data.

text

public static final Filter<Text> text()
Return a Filter that matches any Text data (which includes CDATA since that is a subclass of Text).

Returns:
a Filter that matches any Text data (which includes CDATA since that is a subclass of Text).

textOnly

public static final Filter<Text> textOnly()
Return a Filter that matches any Text data (excludes CDATA instances).

Returns:
a Filter that matches any Text data (which excludes CDATA instances).

fboolean

public static final Filter<java.lang.Boolean> fboolean()
Return a Filter that matches any Boolean data.

Returns:
a Filter that matches any Boolean data.

fstring

public static final Filter<java.lang.String> fstring()
Return a Filter that matches any String data.

Returns:
a Filter that matches any String data.

fdouble

public static final Filter<java.lang.Double> fdouble()
Return a Filter that matches any Double data.

Returns:
a Filter that matches any Double data.

fclass

public static final <F> Filter<F> fclass(java.lang.Class<F> clazz)
Return a Filter that matches any data of the specified Class.

Type Parameters:
F - The generic type of the content returned by this Filter
Parameters:
clazz - the Class type to match in the filter
Returns:
a Filter that matches any data of the specified Class.

fpassthrough

public static final Filter<java.lang.Object> fpassthrough()
Return a filter that does no filtering at all - everything matches.

Returns:
A Pass-Through Filter.

JDOM
2.0.5

Copyright 2013 Jason Hunter, Brett McLaughlin. All Rights Reserved.