Top Description Fields Constructors Methods
org.eclipse.persistence.jpa.jpql.tools.model

public abstract Class BaseJPQLQueryFormatter

extends Object
implements StateObjectVisitor, IJPQLQueryFormatter
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.jpa.jpql.tools.model.IJPQLQueryFormatter, org.eclipse.persistence.jpa.jpql.tools.model.query.StateObjectVisitor
Known Direct Subclasses
org.eclipse.persistence.jpa.jpql.tools.model.AbstractActualJPQLQueryFormatter, org.eclipse.persistence.jpa.jpql.tools.model.AbstractJPQLQueryFormatter
Annotations
@SuppressWarnings:nls
Imports
org.eclipse.persistence.jpa.jpql.Assert, org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject, .StateObjectVisitor

An abstract implementation of a IJPQLQueryFormatter.
Author
Pascal Filion
Since
2.4
Version
2.4

Field Summary

Modifier and TypeField and Description
protected static final String
COMMA

The constant for a comma: ','.

protected static final String
COMMA_SPACE

The constant for a comma followed by a space: ', '.

protected static final String
LEFT_PARENTHESIS

The constant for the left parenthesis: '('.

protected static final String
RIGHT_PARENTHESIS

The constant for the right parenthesis: ')'.

protected static final String
SPACE

The constant for a space: '  '.

protected final IJPQLQueryFormatter.IdentifierStyle
style

Determines how the JPQL identifiers are written out.

protected final StringBuilder
writer

The holder of the string representation of the JPQL query.

Constructor Summary

AccessConstructor and Description
protected
BaseJPQLQueryFormatter(IJPQLQueryFormatter.IdentifierStyle
Determines how the JPQL identifiers are written out, which is used if the StateObject was modified after its creation
style
)

Creates a new BaseJPQLQueryFormatter.

Method Summary

Modifier and TypeMethod and Description
protected String

Returns:

By default the given identifier is returned
formatIdentifier
(String
JPQL identifier to format
identifier
)

Formats the given JPQL identifier, if it needs to be decorated with more information.

public IJPQLQueryFormatter.IdentifierStyle

Returns:

One of the possible ways to format the JPQL identifiers
getIdentifierStyle
()

Returns the style to use when formatting the JPQL identifiers.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public String
toString(StateObject
The StateObject that represents a complete or incomplete JPQL query
stateObject
)

Implements org.eclipse.persistence.jpa.jpql.tools.model.IJPQLQueryFormatter.toString.

Creates a string representation of the given StateObject.
protected void
toText(StateObject
The decorated StateObject to traverse without going through the decorator
stateObject
)

Visits the given StateObject and prevents its decorator to be called, which will prevent any possible recursion when the decorator is outputting the information.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

COMMAback to summary
protected static final String COMMA

The constant for a comma: ','.

COMMA_SPACEback to summary
protected static final String COMMA_SPACE

The constant for a comma followed by a space: ', '.

LEFT_PARENTHESISback to summary
protected static final String LEFT_PARENTHESIS

The constant for the left parenthesis: '('.

RIGHT_PARENTHESISback to summary
protected static final String RIGHT_PARENTHESIS

The constant for the right parenthesis: ')'.

SPACEback to summary
protected static final String SPACE

The constant for a space: '  '.

styleback to summary
protected final IJPQLQueryFormatter.IdentifierStyle style

Determines how the JPQL identifiers are written out.

writerback to summary
protected final StringBuilder writer

The holder of the string representation of the JPQL query.

Constructor Detail

BaseJPQLQueryFormatterback to summary
protected BaseJPQLQueryFormatter(IJPQLQueryFormatter.IdentifierStyle style)

Creates a new BaseJPQLQueryFormatter.

Parameters
style:IJPQLQueryFormatter.IdentifierStyle

Determines how the JPQL identifiers are written out, which is used if the StateObject was modified after its creation

Exceptions
NullPointerException:
The IdentifierStyle cannot be null

Method Detail

formatIdentifierback to summary
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:String

JPQL identifier to format

Returns:String

By default the given identifier is returned

getIdentifierStyleback to summary
public IJPQLQueryFormatter.IdentifierStyle getIdentifierStyle()

Returns the style to use when formatting the JPQL identifiers.

Returns:IJPQLQueryFormatter.IdentifierStyle

One of the possible ways to format the JPQL identifiers

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
toStringback to summary
public String toString(StateObject stateObject)

Implements org.eclipse.persistence.jpa.jpql.tools.model.IJPQLQueryFormatter.toString.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.IJPQLQueryFormatter.toString.

Creates a string representation of the given StateObject.

Parameters
stateObject:StateObject

The StateObject that represents a complete or incomplete JPQL query

Returns:String

The string representation of the given StateObject

Annotations
@Override
toTextback to summary
protected void toText(StateObject stateObject)

Visits the given StateObject and prevents its decorator to be called, which will prevent any possible recursion when the decorator is outputting the information.

Parameters
stateObject:StateObject

The decorated StateObject to traverse without going through the decorator