Top Description Fields Constructors Methods
org.apache.commons.collections4.functors

public final Class InstanceofPredicate

extends Object
implements Predicate<Object>, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.apache.commons.collections4.Predicate
Imports
java.io.Serializable, org.apache.commons.collections4.Predicate

Predicate implementation that returns true if the input is an instanceof the type stored in this predicate.
Since
3.0

Field Summary

Modifier and TypeField and Description
private final Class<?>
iType

The type to compare to

private static final long
serialVersionUID

Serial version UID

Constructor Summary

AccessConstructor and Description
public
InstanceofPredicate(final Class<?>
the type to check for
type
)

Constructor that performs no validation.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if input is of stored type
evaluate
(final Object
the input object
object
)

Implements org.apache.commons.collections4.Predicate.evaluate.

Evaluates the predicate returning true if the input object is of the correct type.
public Class<?>

Returns:

the type
getType
()

Gets the type to compare to.

public static Predicate<Object>

Returns:

the predicate
instanceOfPredicate
(final Class<?>
the type to check for, may not be null
type
)

Factory to create the identity predicate.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

iTypeback to summary
private final Class<?> iType

The type to compare to

serialVersionUIDback to summary
private static final long serialVersionUID

Serial version UID

Constructor Detail

InstanceofPredicateback to summary
public InstanceofPredicate(final Class<?> type)

Constructor that performs no validation. Use instanceOfPredicate if you want that.

Parameters
type:Class<?>

the type to check for

Method Detail

evaluateback to summary
public boolean evaluate(final Object object)

Implements org.apache.commons.collections4.Predicate.evaluate.

Evaluates the predicate returning true if the input object is of the correct type.

Parameters
object:Object

the input object

Returns:boolean

true if input is of stored type

Annotations
@Override
getTypeback to summary
public Class<?> getType()

Gets the type to compare to.

Returns:Class<?>

the type

Since
3.1
instanceOfPredicateback to summary
public static Predicate<Object> instanceOfPredicate(final Class<?> type)

Factory to create the identity predicate.

Parameters
type:Class<?>

the type to check for, may not be null

Returns:Predicate<Object>

the predicate

Exceptions
NullPointerException:
if the class is null