Class AbstractActualJPQLQueryFormatter
- java.lang.Object
-
- org.eclipse.persistence.jpa.jpql.tools.model.BaseJPQLQueryFormatter
-
- org.eclipse.persistence.jpa.jpql.tools.model.AbstractActualJPQLQueryFormatter
-
- All Implemented Interfaces:
IJPQLQueryFormatter
,StateObjectVisitor
- Direct Known Subclasses:
DefaultActualJPQLQueryFormatter
,EclipseLinkActualJPQLQueryFormatter
public abstract class AbstractActualJPQLQueryFormatter extends BaseJPQLQueryFormatter
ThisIJPQLQueryFormatter
is used to generate a string representation of aStateObject
based on how it was parsed, which means this formatter can only be used when theStateObject
was created by parsing a JPQL query because it needs to retrieve parsing information from the correspondingExpression
.It is possible to partially match the JPQL query that was parsed, the value of exactMatch will determine whether the string representation of any given
StateObject
should reflect the exact string that was parsed.true
will use every bit of information contained in the correspondingExpression
to perfectly match what was parsed (case of JPQL identifiers and the presence of whitespace);false
will only match the case sensitivity of the JPQL identifiers.- Version:
- 2.5
- 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 boolean
exactMatch
Determines whether the string representation of any givenStateObject
should reflect the exact string that was parsed:true
will use every bit of information contained in the correspondingExpression
to perfectly match what was parsed;false
will only match the case sensitivity of the JPQL identifiers.-
Fields inherited from class org.eclipse.persistence.jpa.jpql.tools.model.BaseJPQLQueryFormatter
COMMA, COMMA_SPACE, LEFT_PARENTHESIS, RIGHT_PARENTHESIS, SPACE, style, writer
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractActualJPQLQueryFormatter(boolean exactMatch)
Creates a newAbstractActualJPQLQueryFormatter
.protected
AbstractActualJPQLQueryFormatter(boolean exactMatch, IJPQLQueryFormatter.IdentifierStyle style)
Creates a newAbstractActualJPQLQueryFormatter
.
-
Method Summary
-
Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.BaseJPQLQueryFormatter
formatIdentifier, getIdentifierStyle, toString, toString, toText
-
-
-
-
Field Detail
-
exactMatch
protected final boolean exactMatch
Determines whether the string representation of any givenStateObject
should reflect the exact string that was parsed:true
will use every bit of information contained in the correspondingExpression
to perfectly match what was parsed;false
will only match the case sensitivity of the JPQL identifiers.
-
-
Constructor Detail
-
AbstractActualJPQLQueryFormatter
protected AbstractActualJPQLQueryFormatter(boolean exactMatch)
Creates a newAbstractActualJPQLQueryFormatter
.- Parameters:
exactMatch
- Determines whether the string representation of any givenStateObject
should reflect the exact string that was parsed:true
will use every bit of information contained in the correspondingExpression
to perfectly match what was parsed (case of JPQL identifiers and the presence of whitespace);false
will only match the case sensitivity of the JPQL identifiers
-
AbstractActualJPQLQueryFormatter
protected AbstractActualJPQLQueryFormatter(boolean exactMatch, IJPQLQueryFormatter.IdentifierStyle style)
Creates a newAbstractActualJPQLQueryFormatter
.- Parameters:
exactMatch
- Determines whether the string representation of any givenStateObject
should reflect the exact string that was parsed:true
will use every bit of information contained in the correspondingExpression
to perfectly match what was parsed (case of JPQL identifiers and the presence of whitespace);false
will only match the case sensitivity of the JPQL identifiersstyle
- Determines how the JPQL identifiers are written out, which is used if theStateObject
was modified after its creation- Throws:
java.lang.NullPointerException
- The IdentifierStyle cannot benull
-
-
Method Detail
-
appendIdentifier
protected void appendIdentifier(java.lang.String actualIdentifier, java.lang.String identifier)
Appends the given actual identifier if it's not an empty string, otherwise the second identifier will be appended.- Parameters:
actualIdentifier
- The actual JPQL identifier to append to the writer if it's not an empty stringidentifier
- The uppercase constant of the JPQL identifier to append if the actual one is an empty string
-
isUsingExactMatch
public boolean isUsingExactMatch()
Determines whether the string representation of any givenStateObject
should reflect the exact string that was parsed.- Returns:
true
will use every bit of information contained in the correspondingExpression
to perfectly match what was parsed;false
will only match the case sensitivity of the JPQL identifiers
-
shouldOutput
protected boolean shouldOutput(Expression expression)
-
toStringAggregateFunction
protected void toStringAggregateFunction(AggregateFunctionStateObject stateObject)
-
toStringChildren
protected void toStringChildren(ListHolderStateObject<? extends StateObject> stateObject, boolean comma)
-
toStringCompound
protected void toStringCompound(CompoundExpressionStateObject stateObject, java.lang.String identifier)
-
toStringDoubleEncapsulated
protected void toStringDoubleEncapsulated(AbstractDoubleEncapsulatedExpressionStateObject stateObject)
-
toStringEncapsulatedIdentificationVariable
protected void toStringEncapsulatedIdentificationVariable(EncapsulatedIdentificationVariableExpressionStateObject stateObject)
-
toStringFromClause
protected void toStringFromClause(AbstractFromClauseStateObject stateObject)
-
toStringIdentificationVariableDeclaration
protected void toStringIdentificationVariableDeclaration(AbstractIdentificationVariableDeclarationStateObject stateObject)
-
toStringModifyStatement
protected void toStringModifyStatement(AbstractModifyStatementStateObject stateObject)
-
toStringPathExpression
protected void toStringPathExpression(AbstractPathExpressionStateObject stateObject)
-
toStringRangeVariableDeclaration
protected void toStringRangeVariableDeclaration(AbstractRangeVariableDeclarationStateObject stateObject)
-
toStringSelectStatement
protected boolean toStringSelectStatement(AbstractSelectStatementStateObject stateObject)
-
toStringSimpleStateObject
protected void toStringSimpleStateObject(SimpleStateObject stateObject)
-
toStringSingleEncapsulated
protected void toStringSingleEncapsulated(AbstractSingleEncapsulatedExpressionStateObject stateObject)
-
toStringTripleEncapsulated
protected void toStringTripleEncapsulated(AbstractTripleEncapsulatedExpressionStateObject stateObject)
-
visit
public void visit(AbsExpressionStateObject stateObject)
Visits the givenAbsExpressionStateObject
.- Parameters:
stateObject
- TheAbsExpressionStateObject
to visit
-
visit
public void visit(AbstractSchemaNameStateObject stateObject)
Visits the givenAbstractSchemaNameStateObject
.- Parameters:
stateObject
- TheAbstractSchemaNameStateObject
to visit
-
visit
public void visit(AdditionExpressionStateObject stateObject)
Visits the givenAdditionExpressionStateObject
.- Parameters:
stateObject
- TheAdditionExpressionStateObject
to visit
-
visit
public void visit(AllOrAnyExpressionStateObject stateObject)
Visits the givenAllOrAnyExpressionStateObject
.- Parameters:
stateObject
- TheAllOrAnyExpressionStateObject
to visit
-
visit
public void visit(AndExpressionStateObject stateObject)
Visits the givenAndExpressionStateObject
.- Parameters:
stateObject
- TheAndExpressionStateObject
to visit
-
visit
public void visit(ArithmeticFactorStateObject stateObject)
Visits the givenArithmeticFactorStateObject
.- Parameters:
stateObject
- TheArithmeticFactorStateObject
to visit
-
visit
public void visit(AvgFunctionStateObject stateObject)
Visits the givenAvgFunctionStateObject
.- Parameters:
stateObject
- TheAvgFunctionStateObject
to visit
-
visit
public void visit(BadExpressionStateObject stateObject)
Visits the givenBadExpressionStateObject
.- Parameters:
stateObject
- TheBadExpressionStateObject
to visit
-
visit
public void visit(BetweenExpressionStateObject stateObject)
Visits the givenBetweenExpressionStateObject
.- Parameters:
stateObject
- TheBetweenExpressionStateObject
to visit
-
visit
public void visit(CaseExpressionStateObject stateObject)
Visits the givenCaseExpressionStateObject
.- Parameters:
stateObject
- TheCaseExpressionStateObject
to visit
-
visit
public void visit(CoalesceExpressionStateObject stateObject)
Visits the givenCoalesceExpressionStateObject
.- Parameters:
stateObject
- TheCoalesceExpressionStateObject
to visit
-
visit
public void visit(CollectionMemberDeclarationStateObject stateObject)
Visits the givenCollectionMemberDeclarationStateObject
.- Parameters:
stateObject
- TheCollectionMemberDeclarationStateObject
to visit
-
visit
public void visit(CollectionMemberExpressionStateObject stateObject)
Visits the givenCollectionMemberExpressionStateObject
.- Parameters:
stateObject
- TheCollectionMemberExpressionStateObject
to visit
-
visit
public void visit(CollectionValuedPathExpressionStateObject stateObject)
Visits the givenCollectionValuedPathExpressionStateObject
.- Parameters:
stateObject
- TheCollectionValuedPathExpressionStateObject
to visit
-
visit
public void visit(ComparisonExpressionStateObject stateObject)
Visits the givenComparisonExpressionStateObject
.- Parameters:
stateObject
- TheComparisonExpressionStateObject
to visit
-
visit
public void visit(ConcatExpressionStateObject stateObject)
Visits the givenConcatExpressionStateObject
.- Parameters:
stateObject
- TheConcatExpressionStateObject
to visit
-
visit
public void visit(ConstructorExpressionStateObject stateObject)
Visits the givenConstructorExpressionStateObject
.- Parameters:
stateObject
- TheConstructorExpressionStateObject
to visit
-
visit
public void visit(CountFunctionStateObject stateObject)
Visits the givenCountFunctionStateObject
.- Parameters:
stateObject
- TheCountFunctionStateObject
to visit
-
visit
public void visit(DateTimeStateObject stateObject)
Visits the givenDateTimeStateObject
.- Parameters:
stateObject
- TheDateTimeStateObject
to visit
-
visit
public void visit(DeleteClauseStateObject stateObject)
Visits the givenDeleteClauseStateObject
.- Parameters:
stateObject
- TheDeleteClauseStateObject
to visit
-
visit
public void visit(DeleteStatementStateObject stateObject)
Visits the givenDeleteStatementStateObject
.- Parameters:
stateObject
- TheDeleteStatementStateObject
to visit
-
visit
public void visit(DerivedPathIdentificationVariableDeclarationStateObject stateObject)
Visits the givenDerivedPathIdentificationVariableDeclarationStateObject
.- Parameters:
stateObject
- TheDerivedPathIdentificationVariableDeclarationStateObject
to visit
-
visit
public void visit(DerivedPathVariableDeclarationStateObject stateObject)
Visits the givenDerivedPathVariableDeclarationStateObject
.- Parameters:
stateObject
- TheDerivedPathVariableDeclarationStateObject
to visit
-
visit
public void visit(DivisionExpressionStateObject stateObject)
Visits the givenDivisionExpressionStateObject
.- Parameters:
stateObject
- TheDivisionExpressionStateObject
to visit
-
visit
public void visit(EmptyCollectionComparisonExpressionStateObject stateObject)
Visits the givenEmptyCollectionComparisonExpressionStateObject
.- Parameters:
stateObject
- TheEmptyCollectionComparisonExpressionStateObject
to visit
-
visit
public void visit(EntityTypeLiteralStateObject stateObject)
Visits the givenEntityTypeLiteralStateObject
.- Parameters:
stateObject
- TheEntityTypeLiteralStateObject
to visit
-
visit
public void visit(EntryExpressionStateObject stateObject)
Visits the givenEntryExpressionStateObject
.- Parameters:
stateObject
- TheEntryExpressionStateObject
to visit
-
visit
public void visit(EnumTypeStateObject stateObject)
Visits the givenEnumTypeStateObject
.- Parameters:
stateObject
- TheEnumTypeStateObject
to visit
-
visit
public void visit(ExistsExpressionStateObject stateObject)
Visits the givenExistsExpressionStateObject
.- Parameters:
stateObject
- TheExistsExpressionStateObject
to visit
-
visit
public void visit(FromClauseStateObject stateObject)
Visits the givenFromClauseStateObject
.- Parameters:
stateObject
- TheFromClauseStateObject
to visit
-
visit
public void visit(FunctionExpressionStateObject stateObject)
Visits the givenFunctionExpressionStateObject
.- Parameters:
stateObject
- TheFunctionExpressionStateObject
to visit
-
visit
public void visit(GroupByClauseStateObject stateObject)
Visits the givenGroupByClauseStateObject
.- Parameters:
stateObject
- TheGroupByClauseStateObject
to visit
-
visit
public void visit(HavingClauseStateObject stateObject)
Visits the givenHavingClauseStateObject
.- Parameters:
stateObject
- TheHavingClauseStateObject
to visit
-
visit
public void visit(IdentificationVariableDeclarationStateObject stateObject)
Visits the givenIdentificationVariableDeclarationStateObject
.- Parameters:
stateObject
- TheIdentificationVariableDeclarationStateObject
to visit
-
visit
public void visit(IdentificationVariableStateObject stateObject)
Visits the givenIdentificationVariableStateObject
.- Parameters:
stateObject
- TheIdentificationVariableStateObject
to visit
-
visit
public void visit(IndexExpressionStateObject stateObject)
Visits the givenIndexExpressionStateObject
.- Parameters:
stateObject
- TheIndexExpressionStateObject
to visit
-
visit
public void visit(InExpressionStateObject stateObject)
Visits the givenInExpressionStateObject
.- Parameters:
stateObject
- TheInExpressionStateObject
to visit
-
visit
public void visit(InputParameterStateObject stateObject)
Visits the givenInputParameterStateObject
.- Parameters:
stateObject
- TheInputParameterStateObject
to visit
-
visit
public void visit(JoinStateObject stateObject)
Visits the givenJoinStateObject
.- Parameters:
stateObject
- TheJPQLQueryStateObject
to visit
-
visit
public void visit(JPQLQueryStateObject stateObject)
Visits the givenJPQLQueryStateObject
.- Parameters:
stateObject
- TheJPQLQueryStateObject
to visit
-
visit
public void visit(KeyExpressionStateObject stateObject)
Visits the givenKeyExpressionStateObject
.- Parameters:
stateObject
- TheKeyExpressionStateObject
to visit
-
visit
public void visit(KeywordExpressionStateObject stateObject)
Visits the givenKeywordExpressionStateObject
.- Parameters:
stateObject
- TheKeywordExpressionStateObject
to visit
-
visit
public void visit(LengthExpressionStateObject stateObject)
Visits the givenLengthExpressionStateObject
.- Parameters:
stateObject
- TheLengthExpressionStateObject
to visit
-
visit
public void visit(LikeExpressionStateObject stateObject)
Visits the givenLikeExpressionStateObject
.- Parameters:
stateObject
- TheLikeExpressionStateObject
to visit
-
visit
public void visit(LocateExpressionStateObject stateObject)
Visits the givenLocateExpressionStateObject
.- Parameters:
stateObject
- TheLocateExpressionStateObject
to visit
-
visit
public void visit(LowerExpressionStateObject stateObject)
Visits the givenLowerExpressionStateObject
.- Parameters:
stateObject
- TheLowerExpressionStateObject
to visit
-
visit
public void visit(MaxFunctionStateObject stateObject)
Visits the givenMaxFunctionStateObject
.- Parameters:
stateObject
- TheMaxFunctionStateObject
to visit
-
visit
public void visit(MinFunctionStateObject stateObject)
Visits the givenWhereClauseStateObject
.- Parameters:
stateObject
- TheWhereClauseStateObject
to visit
-
visit
public void visit(ModExpressionStateObject stateObject)
Visits the givenModExpressionStateObject
.- Parameters:
stateObject
- TheModExpressionStateObject
to visit
-
visit
public void visit(MultiplicationExpressionStateObject stateObject)
Visits the givenMultiplicationExpressionStateObject
.- Parameters:
stateObject
- TheMultiplicationExpressionStateObject
to visit
-
visit
public void visit(NotExpressionStateObject stateObject)
Visits the givenNotExpressionStateObject
.- Parameters:
stateObject
- TheNotExpressionStateObject
to visit
-
visit
public void visit(NullComparisonExpressionStateObject stateObject)
Visits the givenNullComparisonExpressionStateObject
.- Parameters:
stateObject
- TheNullComparisonExpressionStateObject
to visit
-
visit
public void visit(NullIfExpressionStateObject stateObject)
Visits the givenNullIfExpressionStateObject
.- Parameters:
stateObject
- TheNullIfExpressionStateObject
to visit
-
visit
public void visit(NumericLiteralStateObject stateObject)
Visits the givenNumericLiteralStateObject
.- Parameters:
stateObject
- TheNumericLiteralStateObject
to visit
-
visit
public void visit(ObjectExpressionStateObject stateObject)
Visits the givenObjectExpressionStateObject
.- Parameters:
stateObject
- TheObjectExpressionStateObject
to visit
-
visit
public void visit(OrderByClauseStateObject stateObject)
Visits the givenOrderByClauseStateObject
.- Parameters:
stateObject
- TheOrderByClauseStateObject
to visit
-
visit
public void visit(OrderByItemStateObject stateObject)
Visits the givenOrderByItemStateObject
.- Parameters:
stateObject
- TheOrderByItemStateObject
to visit
-
visit
public void visit(OrExpressionStateObject stateObject)
Visits the givenOrExpressionStateObject
.- Parameters:
stateObject
- TheOrExpressionStateObject
to visit
-
visit
public void visit(RangeVariableDeclarationStateObject stateObject)
Visits the givenRangeVariableDeclarationStateObject
.- Parameters:
stateObject
- TheRangeVariableDeclarationStateObject
to visit
-
visit
public void visit(ResultVariableStateObject stateObject)
Visits the givenResultVariableStateObject
.- Parameters:
stateObject
- TheResultVariableStateObject
to visit
-
visit
public void visit(SelectClauseStateObject stateObject)
Visits the givenSelectClauseStateObject
.- Parameters:
stateObject
- TheSelectClauseStateObject
to visit
-
visit
public void visit(SelectStatementStateObject stateObject)
Visits the givenSelectStatementStateObject
.- Parameters:
stateObject
- TheSelectStatementStateObject
to visit
-
visit
public void visit(SimpleFromClauseStateObject stateObject)
Visits the givenSimpleFromClauseStateObject
.- Parameters:
stateObject
- TheSimpleFromClauseStateObject
to visit
-
visit
public void visit(SimpleSelectClauseStateObject stateObject)
Visits the givenSimpleSelectClauseStateObject
.- Parameters:
stateObject
- TheSimpleSelectClauseStateObject
to visit
-
visit
public void visit(SimpleSelectStatementStateObject stateObject)
Visits the givenSimpleSelectStatementStateObject
.- Parameters:
stateObject
- TheSimpleSelectStatementStateObject
to visit
-
visit
public void visit(SizeExpressionStateObject stateObject)
Visits the givenSizeExpressionStateObject
.- Parameters:
stateObject
- TheSizeExpressionStateObject
to visit
-
visit
public void visit(SqrtExpressionStateObject stateObject)
Visits the givenSqrtExpressionStateObject
.- Parameters:
stateObject
- TheSqrtExpressionStateObject
to visit
-
visit
public void visit(StateFieldPathExpressionStateObject stateObject)
Visits the givenStateFieldPathExpressionStateObject
.- Parameters:
stateObject
- TheStateFieldPathExpressionStateObject
to visit
-
visit
public void visit(StringLiteralStateObject stateObject)
Visits the givenStringLiteralStateObject
.- Parameters:
stateObject
- TheStringLiteralStateObject
to visit
-
visit
public void visit(SubExpressionStateObject stateObject)
Visits the givenSubExpressionStateObject
.- Parameters:
stateObject
- TheSubExpressionStateObject
to visit
-
visit
public void visit(SubstringExpressionStateObject stateObject)
Visits the givenSubstringExpressionStateObject
.- Parameters:
stateObject
- TheSubstringExpressionStateObject
to visit
-
visit
public void visit(SubtractionExpressionStateObject stateObject)
Visits the givenSubtractionExpressionStateObject
.- Parameters:
stateObject
- TheSubtractionExpressionStateObject
to visit
-
visit
public void visit(SumFunctionStateObject stateObject)
Visits the givenSumFunctionStateObject
.- Parameters:
stateObject
- TheSumFunctionStateObject
to visit
-
visit
public void visit(TreatExpressionStateObject stateObject)
Visits the givenTreatExpressionStateObject
.- Parameters:
stateObject
- TheTreatExpressionStateObject
to visit
-
visit
public void visit(TrimExpressionStateObject stateObject)
Visits the givenTrimExpressionStateObject
.- Parameters:
stateObject
- TheTrimExpressionStateObject
to visit
-
visit
public void visit(TypeExpressionStateObject stateObject)
Visits the givenTypeExpressionStateObject
.- Parameters:
stateObject
- TheTypeExpressionStateObject
to visit
-
visit
public void visit(UnknownExpressionStateObject stateObject)
Visits the givenUnknownExpressionStateObject
.- Parameters:
stateObject
- TheUnknownExpressionStateObject
to visit
-
visit
public void visit(UpdateClauseStateObject stateObject)
Visits the givenUpdateClauseStateObject
.- Parameters:
stateObject
- TheUpdateClauseStateObject
to visit
-
visit
public void visit(UpdateItemStateObject stateObject)
Visits the givenUpdateItemStateObject
.- Parameters:
stateObject
- TheUpdateItemStateObject
to visit
-
visit
public void visit(UpdateStatementStateObject stateObject)
Visits the givenUpdateStatementStateObject
.- Parameters:
stateObject
- TheUpdateStatementStateObject
to visit
-
visit
public void visit(UpperExpressionStateObject stateObject)
Visits the givenUpperExpressionStateObject
.- Parameters:
stateObject
- TheUpperExpressionStateObject
to visit
-
visit
public void visit(ValueExpressionStateObject stateObject)
Visits the givenValueExpressionStateObject
.- Parameters:
stateObject
- TheValueExpressionStateObject
to visit
-
visit
public void visit(WhenClauseStateObject stateObject)
Visits the givenWhenClauseStateObject
.- Parameters:
stateObject
- TheWhenClauseStateObject
to visit
-
visit
public void visit(WhereClauseStateObject stateObject)
Visits the givenWhereClauseStateObject
.- Parameters:
stateObject
- TheWhereClauseStateObject
to visit
-
-