Top Description Fields Constructors Methods
org.jdom2.filter

public final Class Filters

extends Object
Class Inheritance
Imports
org.jdom2.Attribute, .CDATA, .Comment, .Content, .DocType, .Document, .Element, .EntityRef, .Namespace, .ProcessingInstruction, .Text

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

Field Summary

Modifier and TypeField and Description
private static final Filter<Attribute>
private static final Filter<Boolean>
private static final Filter<CDATA>
private static final Filter<Comment>
private static final Filter<Content>
private static final Filter<DocType>
private static final Filter<Document>
private static final Filter<Double>
private static final Filter<Element>
private static final Filter<EntityRef>
private static final Filter<Object>
private static final Filter<ProcessingInstruction>
private static final Filter<String>
private static final Filter<Text>
private static final Filter<Text>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static final Filter<Attribute>

Returns:

a Filter that matches any Attribute data.
attribute
()

Return a Filter that matches any Attribute data.

public static final Filter<Attribute>

Returns:

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

Return a Filter that matches any Attribute data with the specified name.

public static final Filter<Attribute>

Returns:

a Filter that matches any Attribute data with the specified name and namespace.
attribute
(String
The name for all the Attributes to have.
name
,
Namespace
The Namespace for all the Attributes to have.
ns
)

Return a Filter that matches any Attribute data with the specified name and namespace.

public static final Filter<Attribute>

Returns:

a Filter that matches any Attribute data with the specified namespace.
attribute
(Namespace
The Namespace for all the Attributes to have.
ns
)

Return a Filter that matches any Attribute data with the specified namespace.

public static final Filter<CDATA>

Returns:

a Filter that matches any CDATA data.
cdata
()

Return a Filter that matches any CDATA data.

public static final Filter<Comment>

Returns:

a Filter that matches any Comment data.
comment
()

Return a Filter that matches any Comment data.

public static final Filter<Content>

Returns:

a Filter that matches any Content data.
content
()

Return a Filter that matches any Content data.

public static final Filter<DocType>

Returns:

a Filter that matches any DocType data.
doctype
()

Return a Filter that matches any DocType data.

public static final Filter<Document>

Returns:

a Filter that matches any Document data.
document
()

Return a Filter that matches any Document data.

public static final Filter<Element>

Returns:

a Filter that matches any Element data.
element
()

Return a Filter that matches any Element data.

public static final Filter<Element>

Returns:

a Filter that matches any Element data with the specified name.
element
(String
The name of Elements to match.
name
)

Return a Filter that matches any Element data with the specified name.

public static final Filter<Element>

Returns:

a Filter that matches any Element data with the specified name and Namespace.
element
(String
The name of Elements to match.
name
,
Namespace
The Namespace to match
ns
)

Return a Filter that matches any Element data with the specified name and Namespace.

public static final Filter<Element>

Returns:

a Filter that matches any Element data with the specified Namespace.
element
(Namespace
The Namespace to match
ns
)

Return a Filter that matches any Element data with the specified Namespace.

public static final Filter<EntityRef>

Returns:

a Filter that matches any EntityRef data.
entityref
()

Return a Filter that matches any EntityRef data.

public static final Filter<Boolean>

Returns:

a Filter that matches any Boolean data.
fboolean
()

Return a Filter that matches any Boolean data.

public static final <
The generic type of the content returned by this Filter
F
>
Filter<F>

Returns:

a Filter that matches any data of the specified Class.
fclass
(Class<F>
the Class type to match in the filter
clazz
)

Return a Filter that matches any data of the specified Class.

public static final Filter<Double>

Returns:

a Filter that matches any Double data.
fdouble
()

Return a Filter that matches any Double data.

public static final Filter<Object>

Returns:

A Pass-Through Filter.
fpassthrough
()

Return a filter that does no filtering at all - everything matches.

public static final Filter<String>

Returns:

a Filter that matches any String data.
fstring
()

Return a Filter that matches any String data.

public static final Filter<ProcessingInstruction>

Returns:

a Filter that matches any ProcessingInstruction data.
processinginstruction
()

Return a Filter that matches any ProcessingInstruction data.

public static final Filter<Text>

Returns:

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

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

public static final Filter<Text>

Returns:

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

Return a Filter that matches any Text data (excludes CDATA instances).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fattributeback to summary
private static final Filter<Attribute> fattribute
fbooleanback to summary
private static final Filter<Boolean> fboolean
fcdataback to summary
private static final Filter<CDATA> fcdata
fcommentback to summary
private static final Filter<Comment> fcomment
fcontentback to summary
private static final Filter<Content> fcontent
fdoctypeback to summary
private static final Filter<DocType> fdoctype
fdocumentback to summary
private static final Filter<Document> fdocument
fdoubleback to summary
private static final Filter<Double> fdouble
felementback to summary
private static final Filter<Element> felement
fentityrefback to summary
private static final Filter<EntityRef> fentityref
fpassthroughback to summary
private static final Filter<Object> fpassthrough
fpiback to summary
private static final Filter<ProcessingInstruction> fpi
fstringback to summary
private static final Filter<String> fstring
ftextback to summary
private static final Filter<Text> ftext
ftextonlyback to summary
private static final Filter<Text> ftextonly

Constructor Detail

Filtersback to summary
private Filters()

Method Detail

attributeback to summary
public static final Filter<Attribute> attribute()

Return a Filter that matches any Attribute data.

Returns:Filter<Attribute>

a Filter that matches any Attribute data.

attributeback to summary
public static final Filter<Attribute> attribute(String name)

Return a Filter that matches any Attribute data with the specified name.

Parameters
name:String

The name for all the Attributes to have (these can be in any Namespace).

Returns:Filter<Attribute>

a Filter that matches any Attribute data with the specified name.

attributeback to summary
public static final Filter<Attribute> attribute(String name, Namespace ns)

Return a Filter that matches any Attribute data with the specified name and namespace.

Parameters
name:String

The name for all the Attributes to have.

ns:Namespace

The Namespace for all the Attributes to have.

Returns:Filter<Attribute>

a Filter that matches any Attribute data with the specified name and namespace.

attributeback to summary
public static final Filter<Attribute> attribute(Namespace ns)

Return a Filter that matches any Attribute data with the specified namespace.

Parameters
ns:Namespace

The Namespace for all the Attributes to have.

Returns:Filter<Attribute>

a Filter that matches any Attribute data with the specified namespace.

cdataback to summary
public static final Filter<CDATA> cdata()

Return a Filter that matches any CDATA data.

Returns:Filter<CDATA>

a Filter that matches any CDATA data.

commentback to summary
public static final Filter<Comment> comment()

Return a Filter that matches any Comment data.

Returns:Filter<Comment>

a Filter that matches any Comment data.

contentback to summary
public static final Filter<Content> content()

Return a Filter that matches any Content data.

Returns:Filter<Content>

a Filter that matches any Content data.

doctypeback to summary
public static final Filter<DocType> doctype()

Return a Filter that matches any DocType data.

Returns:Filter<DocType>

a Filter that matches any DocType data.

documentback to summary
public static final Filter<Document> document()

Return a Filter that matches any Document data.

Returns:Filter<Document>

a Filter that matches any Document data.

elementback to summary
public static final Filter<Element> element()

Return a Filter that matches any Element data.

Returns:Filter<Element>

a Filter that matches any Element data.

elementback to summary
public static final Filter<Element> element(String name)

Return a Filter that matches any Element data with the specified name.

Parameters
name:String

The name of Elements to match.

Returns:Filter<Element>

a Filter that matches any Element data with the specified name.

elementback to summary
public static final Filter<Element> element(String name, Namespace ns)

Return a Filter that matches any Element data with the specified name and Namespace.

Parameters
name:String

The name of Elements to match.

ns:Namespace

The Namespace to match

Returns:Filter<Element>

a Filter that matches any Element data with the specified name and Namespace.

elementback to summary
public static final Filter<Element> element(Namespace ns)

Return a Filter that matches any Element data with the specified Namespace.

Parameters
ns:Namespace

The Namespace to match

Returns:Filter<Element>

a Filter that matches any Element data with the specified Namespace.

entityrefback to summary
public static final Filter<EntityRef> entityref()

Return a Filter that matches any EntityRef data.

Returns:Filter<EntityRef>

a Filter that matches any EntityRef data.

fbooleanback to summary
public static final Filter<Boolean> fboolean()

Return a Filter that matches any Boolean data.

Returns:Filter<Boolean>

a Filter that matches any Boolean data.

fclassback to summary
public static final <F> Filter<F> fclass(Class<F> clazz)

Return a Filter that matches any data of the specified Class.

Parameters
<F>
The generic type of the content returned by this Filter
clazz:Class<F>

the Class type to match in the filter

Returns:Filter<F>

a Filter that matches any data of the specified Class.

fdoubleback to summary
public static final Filter<Double> fdouble()

Return a Filter that matches any Double data.

Returns:Filter<Double>

a Filter that matches any Double data.

fpassthroughback to summary
public static final Filter<Object> fpassthrough()

Return a filter that does no filtering at all - everything matches.

Returns:Filter<Object>

A Pass-Through Filter.

fstringback to summary
public static final Filter<String> fstring()

Return a Filter that matches any String data.

Returns:Filter<String>

a Filter that matches any String data.

processinginstructionback to summary
public static final Filter<ProcessingInstruction> processinginstruction()

Return a Filter that matches any ProcessingInstruction data.

Returns:Filter<ProcessingInstruction>

a Filter that matches any ProcessingInstruction data.

textback to summary
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:Filter<Text>

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

textOnlyback to summary
public static final Filter<Text> textOnly()

Return a Filter that matches any Text data (excludes CDATA instances).

Returns:Filter<Text>

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