db4o

Predicate Class

Extend this class and add your #match() method to run native queries.

For a list of all members of this type, see Predicate Members.

System.Object
   com.db4o.query.Predicate

public abstract class Predicate : Serializable

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

Extend this class and add your #match() method to run native queries. ! The functionality of this class is not available before db4o version 5.0. It is present in 4.x builds for maintenance purposes only !

A class that extends Predicate is required to implement the method #match() following the native query conventions:
- The name of the method is "match".
- The method is public.
- The method returns a boolean.
- The method takes one parameter.
- The type (Class) of the parameter specifies the extent.
- For all instances of the extent that are to be included into the resultset of the query, the method returns true. For all instances that are not to be included the method returns false.

Here is an example of a #match method that follows these conventions:

                    
            public boolean match(Cat cat){
return cat.name.equals("Frizz");
}


Native queries for Java JDK5 and above define a #match method in the abstract Predicate class to ensure these conventions, using generics. Without generics the method is not definable in the Predicate class since alternative method parameter classes would not be possible.

Requirements

Namespace: com.db4o.query

Assembly: db4o (in db4o.dll)

See Also

Predicate Members | com.db4o.query Namespace