public abstract class CursorSpecificationVisitor
extends java.lang.Object
CursorSpecification
objects. A CursorSpecificationVisitor
can implement polymorphic behavior without having access to the internal code of the CursorSpecification
subclasses.
CursorSpecificationVisitor
has a visit method for each of the classes in the CursorSpecification
hierarchy. CursorSpecification
and the subclasses of it have an acceptVisitor
method. The acceptVisitor
method takes as input parameters a CursorSpecificationVisitor
object and an Object
. When an application calls the acceptVisitor
method of a CursorSpecification
, the acceptVisitor
method calls the corresponding visit method of the CursorSpecificationVisitor
. The acceptVisitor
method passes the CursorSpecification
and the Object
to the visit method. For example, if an application calls the acceptVisitor
method of a CompoundCursorSpecification
and passes it a CursorSpecificationVisitor
and an Object
, then the acceptVisitor
method passes the CompoundCursorSpecification
and the Object
to the visitCompoundCursorSpecification
method of the CursorSpecificationVisitor
.
Your context
parameter Object
can be anything you want it to be. A visit method of your CursorSpecificationVisitor
can perform whatever operations you want it to on the CursorSpecification
it receives. For example, a visitCompoundCursorSpecification
method might call the isExtentCalculationSpecified
method of the CompoundCursorSpecification
to discover if the CompoundCursorSpecification
specifies that the extent should be calculated for the CompoundCursor
. The method might then call methods on the context Object
to format and display the resulting information. A visit method must return a java.lang.Object
, which can be whatever you want it to be.
Modifier | Constructor and Description |
---|---|
protected |
CursorSpecificationVisitor()
Creates a new
CursorSpecificationVisitor . |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
visitCompoundCursorSpecification(CompoundCursorSpecification cursorSpecification, java.lang.Object context)
Executes operations on the specified
CompoundCursorSpecification . |
java.lang.Object |
visitCursorSpecification(CursorSpecification cursorSpecification, java.lang.Object context)
Executes operations on any object that is a subclass of
CursorSpecification , which is useful when you do not need subclass-specific information. |
java.lang.Object |
visitValueCursorSpecification(ValueCursorSpecification cursorSpecification, java.lang.Object context)
Executes operations on the specified
ValueCursorSpecification . |
protected CursorSpecificationVisitor()
CursorSpecificationVisitor
.public java.lang.Object visitCursorSpecification(CursorSpecification cursorSpecification, java.lang.Object context)
CursorSpecification
, which is useful when you do not need subclass-specific information. The default implementation of this method returns null
.cursorSpecification
- A CursorSpecification
.context
- An Object
.Object
.public java.lang.Object visitCompoundCursorSpecification(CompoundCursorSpecification cursorSpecification, java.lang.Object context)
CompoundCursorSpecification
. The default implementation of this method calls visitCursorSpecification
.cursorSpecification
- A CompoundCursorSpecification
.context
- An Object
.Object
.public java.lang.Object visitValueCursorSpecification(ValueCursorSpecification cursorSpecification, java.lang.Object context)
ValueCursorSpecification
. The default implementation of this method calls visitCursorSpecification
.cursorSpecification
- A ValueCursorSpecification
.context
- An Object
.Object
.