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 aIJPQLQueryFormatter.- Since:
- 2.4
- Version:
- 2.4
- Author:
- Pascal Filion
-
-
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 StringCOMMAThe constant for a comma: ','.protected static StringCOMMA_SPACEThe constant for a comma followed by a space: ', '.protected static StringLEFT_PARENTHESISThe constant for the left parenthesis: '('.protected static StringRIGHT_PARENTHESISThe constant for the right parenthesis: ')'.protected static StringSPACEThe constant for a space: ' '.protected IJPQLQueryFormatter.IdentifierStylestyleDetermines how the JPQL identifiers are written out.protected StringBuilderwriterThe holder of the string representation of the JPQL query.
-
Constructor Summary
Constructors Modifier Constructor Description protectedBaseJPQLQueryFormatter(IJPQLQueryFormatter.IdentifierStyle style)Creates a newBaseJPQLQueryFormatter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringformatIdentifier(String identifier)Formats the given JPQL identifier, if it needs to be decorated with more information.IJPQLQueryFormatter.IdentifierStylegetIdentifierStyle()Returns the style to use when formatting the JPQL identifiers.StringtoString()StringtoString(StateObject stateObject)Creates a string representation of the givenStateObject.protected voidtoText(StateObject stateObject)Visits the givenStateObjectand 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 StringBuilder writer
The holder of the string representation of the JPQL query.
-
COMMA
protected static final String COMMA
The constant for a comma: ','.- See Also:
- Constant Field Values
-
COMMA_SPACE
protected static final String COMMA_SPACE
The constant for a comma followed by a space: ', '.- See Also:
- Constant Field Values
-
LEFT_PARENTHESIS
protected static final String LEFT_PARENTHESIS
The constant for the left parenthesis: '('.- See Also:
- Constant Field Values
-
RIGHT_PARENTHESIS
protected static final String RIGHT_PARENTHESIS
The constant for the right parenthesis: ')'.- See Also:
- Constant Field Values
-
SPACE
protected static final 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 theStateObjectwas modified after its creation- Throws:
NullPointerException- TheIJPQLQueryFormatter.IdentifierStylecannot benull
-
-
Method Detail
-
formatIdentifier
protected String formatIdentifier(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 String toString(StateObject stateObject)
Description copied from interface:IJPQLQueryFormatterCreates a string representation of the givenStateObject.- Specified by:
toStringin interfaceIJPQLQueryFormatter- Parameters:
stateObject- TheStateObjectthat represents a complete or incomplete JPQL query- Returns:
- The string representation of the given
StateObject
-
toText
protected void toText(StateObject stateObject)
Visits the givenStateObjectand prevents its decorator to be called, which will prevent any possible recursion when the decorator is outputting the information.- Parameters:
stateObject- The decoratedStateObjectto traverse without going through the decorator
-
-