Class BaseJPQLQueryFormatter
java.lang.Object
org.eclipse.persistence.jpa.jpql.tools.model.BaseJPQLQueryFormatter
- All Implemented Interfaces:
IJPQLQueryFormatter
,StateObjectVisitor
- Direct Known Subclasses:
AbstractActualJPQLQueryFormatter
,AbstractJPQLQueryFormatter
public abstract class BaseJPQLQueryFormatter
extends Object
implements StateObjectVisitor, IJPQLQueryFormatter
An abstract implementation of a
IJPQLQueryFormatter
.- Since:
- 2.4
- Version:
- 2.4
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.persistence.jpa.jpql.tools.model.IJPQLQueryFormatter
IJPQLQueryFormatter.IdentifierStyle
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final String
The constant for a comma: ','.protected static final String
The constant for a comma followed by a space: ', '.protected static final String
The constant for the left parenthesis: '('.protected static final String
The constant for the right parenthesis: ')'.protected static final String
The constant for a space: ' '.protected final IJPQLQueryFormatter.IdentifierStyle
Determines how the JPQL identifiers are written out.protected final StringBuilder
The holder of the string representation of the JPQL query. -
Constructor Summary
ModifierConstructorDescriptionprotected
Creates a newBaseJPQLQueryFormatter
. -
Method Summary
Modifier and TypeMethodDescriptionprotected String
formatIdentifier
(String identifier) Formats the given JPQL identifier, if it needs to be decorated with more information.Returns the style to use when formatting the JPQL identifiers.toString()
toString
(StateObject stateObject) Creates a string representation of the givenStateObject
.protected void
toText
(StateObject stateObject) Visits the givenStateObject
and prevents its decorator to be called, which will prevent any possible recursion when the decorator is outputting the information.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.persistence.jpa.jpql.tools.model.query.StateObjectVisitor
visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
-
Field Details
-
style
Determines how the JPQL identifiers are written out. -
writer
The holder of the string representation of the JPQL query. -
COMMA
The constant for a comma: ','.- See Also:
-
COMMA_SPACE
The constant for a comma followed by a space: ', '.- See Also:
-
LEFT_PARENTHESIS
The constant for the left parenthesis: '('.- See Also:
-
RIGHT_PARENTHESIS
The constant for the right parenthesis: ')'.- See Also:
-
SPACE
The constant for a space: ' '.- See Also:
-
-
Constructor Details
-
BaseJPQLQueryFormatter
Creates a newBaseJPQLQueryFormatter
.- Parameters:
style
- Determines how the JPQL identifiers are written out, which is used if theStateObject
was modified after its creation- Throws:
NullPointerException
- TheIJPQLQueryFormatter.IdentifierStyle
cannot benull
-
-
Method Details
-
formatIdentifier
Formats the given JPQL identifier, if it needs to be decorated with more information. Which depends on how the string is created.- Parameters:
identifier
- JPQL identifier to format- Returns:
- By default the given identifier is returned
-
getIdentifierStyle
Returns the style to use when formatting the JPQL identifiers.- Returns:
- One of the possible ways to format the JPQL identifiers
-
toString
-
toString
Description copied from interface:IJPQLQueryFormatter
Creates a string representation of the givenStateObject
.- Specified by:
toString
in interfaceIJPQLQueryFormatter
- Parameters:
stateObject
- TheStateObject
that represents a complete or incomplete JPQL query- Returns:
- The string representation of the given
StateObject
-
toText
Visits the givenStateObject
and prevents its decorator to be called, which will prevent any possible recursion when the decorator is outputting the information.- Parameters:
stateObject
- The decoratedStateObject
to traverse without going through the decorator
-