Top Description Fields Constructors Methods
org.jdom2.filter

public Class ElementFilter

extends AbstractFilter<Element>
Class Inheritance
Imports
org.jdom2.Element, .Namespace

A Filter that only matches org.jdom2.Element objects.
Authors
Jools Enticknap, Bradley S. Huffman

Field Summary

Modifier and TypeField and Description
private String
name

The element name

private Namespace
namespace

The element namespace

private static final long
serialVersionUID

Hides org.jdom2.filter.AbstractFilter.serialVersionUID.

JDOM2 Serialization: Default mechanism

Constructor Summary

AccessConstructor and Description
public
ElementFilter()

Select only the Elements.

public
ElementFilter(String
The name of the Element.
name
)

Select only the Elements with the supplied name in any Namespace.

public
ElementFilter(Namespace
The namespace the Element lives in.
namespace
)

Select only the Elements with the supplied Namespace.

public
ElementFilter(String
The name of the Element.
name
,
Namespace
The namespace the Element lives in.
namespace
)

Select only the Elements with the supplied name and Namespace.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

whether the two filters are equal
equals
(Object
the object to compare against
obj
)

Overrides java.lang.Object.equals.

Returns whether the two filters are equivalent (i.e. the matching names and namespace are equivalent).
public Element

Returns:

true if the objected matched a predfined set of rules.
filter
(Object
The object to verify.
content
)

Implements org.jdom2.filter.Filter.filter.

Check to see if the object matches a predefined set of rules.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from org.jdom2.filter.AbstractFilter:
andfiltermatchesnegateorrefine

Field Detail

nameback to summary
private String name

The element name

namespaceback to summary
private Namespace namespace

The element namespace

serialVersionUIDback to summary
private static final long serialVersionUID

Hides org.jdom2.filter.AbstractFilter.serialVersionUID.

JDOM2 Serialization: Default mechanism

Constructor Detail

ElementFilterback to summary
public ElementFilter()

Select only the Elements.

ElementFilterback to summary
public ElementFilter(String name)

Select only the Elements with the supplied name in any Namespace.

Parameters
name:String

The name of the Element.

ElementFilterback to summary
public ElementFilter(Namespace namespace)

Select only the Elements with the supplied Namespace.

Parameters
namespace:Namespace

The namespace the Element lives in.

ElementFilterback to summary
public ElementFilter(String name, Namespace namespace)

Select only the Elements with the supplied name and Namespace.

Parameters
name:String

The name of the Element.

namespace:Namespace

The namespace the Element lives in.

Method Detail

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Returns whether the two filters are equivalent (i.e. the matching names and namespace are equivalent).

Parameters
obj:Object

the object to compare against

Returns:boolean

whether the two filters are equal

Annotations
@Override
filterback to summary
public Element filter(Object content)

Implements org.jdom2.filter.Filter.filter.

Check to see if the object matches a predefined set of rules.

Parameters
content:Object

The object to verify.

Returns:Element

true if the objected matched a predfined set of rules.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override