Is there a reason why deparsers and the buffer are private in the visitor and deparser classes?
Shouldn't they be protected instead?
For example, I would like to insert some extra output during Insert statement deparsing.
But the StatementDeParser class defines its members as:
public class StatementDeParser implements StatementVisitor {
private ExpressionDeParser expressionDeParser;
private SelectDeParser selectDeParser;
private StringBuilder buffer;
The InsertDeParser defines these members similarly.
If I try to write
@OverRide
public void visit(Insert insert) {
buffer.append("-- an insert statement");
...
}
I get an error saying that buffer is private.
There is a getBuffer method, but using it makes the code cumbersome.
There is no get method for expressionDeParser or selectDeParser, so its much harder
to write code which accesses or manipulates these members.
The value of the visitor and deparser framework would seem to be the ability to modify
selected parts of the deparsing by subclassing and overridding selected methods.
Since these classes are supposed to be subclassed, shouldn't important member variables
be protected instead of private?
Is there a reason why deparsers and the buffer are private in the visitor and deparser classes?
Shouldn't they be protected instead?
For example, I would like to insert some extra output during Insert statement deparsing.
But the StatementDeParser class defines its members as:
public class StatementDeParser implements StatementVisitor {
private ExpressionDeParser expressionDeParser;
private SelectDeParser selectDeParser;
private StringBuilder buffer;
The InsertDeParser defines these members similarly.
If I try to write
@OverRide
public void visit(Insert insert) {
buffer.append("-- an insert statement");
...
}
I get an error saying that buffer is private.
There is a getBuffer method, but using it makes the code cumbersome.
There is no get method for expressionDeParser or selectDeParser, so its much harder
to write code which accesses or manipulates these members.
The value of the visitor and deparser framework would seem to be the ability to modify
selected parts of the deparsing by subclassing and overridding selected methods.
Since these classes are supposed to be subclassed, shouldn't important member variables
be protected instead of private?