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 java.lang.Object implements StateObjectVisitor, IJPQLQueryFormatter
An abstract implementation of aIJPQLQueryFormatter
.- Version:
- 2.4
- Author:
- Pascal Filion
- Since:
- 2.4
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.persistence.jpa.jpql.tools.model.IJPQLQueryFormatter
IJPQLQueryFormatter.IdentifierStyle
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
COMMA
The constant for a comma: ','.protected static java.lang.String
COMMA_SPACE
The constant for a comma followed by a space: ', '.protected static java.lang.String
LEFT_PARENTHESIS
The constant for the left parenthesis: '('.protected static java.lang.String
RIGHT_PARENTHESIS
The constant for the right parenthesis: ')'.protected static java.lang.String
SPACE
The constant for a space: ' '.protected IJPQLQueryFormatter.IdentifierStyle
style
Determines how the JPQL identifiers are written out.protected java.lang.StringBuilder
writer
The holder of the string representation of the JPQL query.
-
Constructor Summary
Constructors Modifier Constructor Description protected
BaseJPQLQueryFormatter(IJPQLQueryFormatter.IdentifierStyle style)
Creates a newBaseJPQLQueryFormatter
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
formatIdentifier(java.lang.String identifier)
Formats the given JPQL identifier, if it needs to be decorated with more information.IJPQLQueryFormatter.IdentifierStyle
getIdentifierStyle()
Returns the style to use when formatting the JPQL identifiers.java.lang.String
toString()
java.lang.String
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 Detail
-
style
protected final IJPQLQueryFormatter.IdentifierStyle style
Determines how the JPQL identifiers are written out.
-
writer
protected final java.lang.StringBuilder writer
The holder of the string representation of the JPQL query.
-
COMMA
protected static final java.lang.String COMMA
The constant for a comma: ','.- See Also:
- Constant Field Values
-
COMMA_SPACE
protected static final java.lang.String COMMA_SPACE
The constant for a comma followed by a space: ', '.- See Also:
- Constant Field Values
-
LEFT_PARENTHESIS
protected static final java.lang.String LEFT_PARENTHESIS
The constant for the left parenthesis: '('.- See Also:
- Constant Field Values
-
RIGHT_PARENTHESIS
protected static final java.lang.String RIGHT_PARENTHESIS
The constant for the right parenthesis: ')'.- See Also:
- Constant Field Values
-
SPACE
protected static final java.lang.String SPACE
The constant for a space: ' '.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BaseJPQLQueryFormatter
protected BaseJPQLQueryFormatter(IJPQLQueryFormatter.IdentifierStyle style)
Creates a newBaseJPQLQueryFormatter
.- Parameters:
style
- Determines how the JPQL identifiers are written out, which is used if theStateObject
was modified after its creation- Throws:
java.lang.NullPointerException
- TheIJPQLQueryFormatter.IdentifierStyle
cannot benull
-
-
Method Detail
-
formatIdentifier
protected java.lang.String formatIdentifier(java.lang.String identifier)
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
public IJPQLQueryFormatter.IdentifierStyle getIdentifierStyle()
Returns the style to use when formatting the JPQL identifiers.- Returns:
- One of the possible ways to format the JPQL identifiers
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
toString
public java.lang.String toString(StateObject stateObject)
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
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.- Parameters:
stateObject
- The decoratedStateObject
to traverse without going through the decorator
-
-