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

public final Class DefaultContentAssistProposals

extends Object
implements ContentAssistProposals
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.jpa.jpql.tools.ContentAssistProposals
Annotations
@SuppressWarnings:nls
Static Imports
org.eclipse.persistence.jpa.jpql.parser.Expression.BETWEEN, .Expression.DELETE_FROM, .Expression.IN, .Expression.INNER_JOIN, .Expression.INNER_JOIN_FETCH, .Expression.IS_EMPTY, .Expression.IS_NOT_EMPTY, .Expression.IS_NOT_NULL, .Expression.IS_NULL, .Expression.JOIN, .Expression.JOIN_FETCH, .Expression.LEFT_JOIN, .Expression.LEFT_JOIN_FETCH, .Expression.LEFT_OUTER_JOIN, .Expression.LEFT_OUTER_JOIN_FETCH, .Expression.MEMBER, .Expression.MEMBER_OF, .Expression.NOT_BETWEEN, .Expression.NOT_IN, .Expression.NOT_MEMBER, .Expression.NOT_MEMBER_OF, .Expression.SELECT, .Expression.UPDATE

The default implementation of ContentAssistProposals which stores the valid proposals.

Provisional API: This interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.

Author
Pascal Filion
Since
2.3
Version
2.5

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
DefaultContentAssistProposals.Result

This contains the result of inserting a proposal into a JPQL query at a given position.

Field Summary

Modifier and TypeField and Description
private String
classNamePrefix

The prefix that is used to filter the list of class names.

private ContentAssistProposals.ClassType
classType

The class type helps to filter the various types of classes, i.e. anonymous, member, interface are never allowed.

private String
private Set<IEntity>
entities

The set of possible abstract schema types.

private Map<IType, DefaultContentAssistProposals.DefaultEnumProposals>
private ContentAssistExtension
extension

This extension can be used to provide additional support to JPQL content assist that is outside the scope of providing proposals related to JPA metadata.

private Set<String>
identificationVariables

The set of possible identification variables.

private Set<String>
identifiers

The set of possible JPQL identifiers.

private JPQLGrammar
jpqlGrammar

The JPQLGrammar that defines how the JPQL query was parsed.

private static final Map<String, String>
LONGUEST_IDENTIFIERS

A JPQL identifier that is mapped to its longest counterpart.

private Set<IMapping>
mappings

The set of possible mappings, which can be state fields, association fields and/or collection fields.

private static final Map<String, List<String>>
ORDERED_IDENTIFIERS

A JPQL identifier that is mapped to the list of counterparts used to find them in the query.

private Map<String, IEntity>
rangeIdentificationVariables

The identification variables mapped to their abstract schema types.

private String
private String

Constructor Summary

AccessConstructor and Description
public
DefaultContentAssistProposals(JPQLGrammar
The JPQLGrammar that defines how the JPQL query was parsed
jpqlGrammar
,
ContentAssistExtension
This extension can be used to provide additional support to JPQL content assist that is outside the scope of providing proposals related to JPA metadata. It adds support for providing suggestions related to class names, enum constants, table names, column names
extension
)

Creates a new DefaultContentAssistProposals.

Method Summary

Modifier and TypeMethod and Description
public Iterable<IEntity>
abstractSchemaTypes()

Implements org.eclipse.persistence.jpa.jpql.tools.ContentAssistProposals.abstractSchemaTypes.

Returns the collection of possible abstract schema types.
public void
addEntity(IEntity
The abstract schema type that is a valid proposal
abstractSchemaType
)

Adds the given IEntity as a possible abstract schema type.

public void
addEnumConstant(IType
The IType of the enum type
enumType
,
String
The enum constant to be added as a valid proposal
enumConstant
)

Adds the constants of the given enum constant as a valid proposal.

public void
addIdentificationVariable(String
The identification variable that is a valid proposal
identificationVariable
)

Adds the given identification variable as a proposal.

public void
addIdentifier(String
The JPQL identifier that is a valid proposal
identifier
)

Adds the given JPQL identifier as a proposal.

public void
addMapping(IMapping
The IMapping of the state field, association field or collection field
mapping
)

Adds the given mapping (state field, association field or collection field) as a valid proposal.

public void
addMappings(Collection<IMapping>
The mappings of the state fields, association fields or collection fields
mappings
)

Adds the given mappings (state fields, association fields or collection fields) as valid proposals.

public void
addRangeIdentificationVariable(String
The range identification variable mapping the abstract schema name
identificationVariable
,
IEntity
The abstract type name that identifies the type of the variable
entity
)

Adds the given range identification variable that is mapping the given abstract schema type.

public DefaultContentAssistProposals.Result
buildEscapedQuery(String
The JPQL query to modify with the given proposal
jpqlQuery
,
String
The proposal to insert into the query
proposal
,
int
The position of insertion
position
,
boolean
Flag that determines if the partial word following the cursor should be left intact or should be replaced by the proposal
insert
)

Implements org.eclipse.persistence.jpa.jpql.tools.ContentAssistProposals.buildEscapedQuery.

Creates a new JPQL query by inserting the given proposal at the given position.
private static Map<String, String>
private static Map<String, List<String>>
public int[]

Returns:

The start and end positions
buildPositions
(WordParser
This parser can be used to retrieve words from the cursor position
wordParser
,
String
The proposal to be inserted into the query
proposal
,
boolean
Flag that determines if the proposal is simply inserted or it should also replace the partial word following the position of the cursor
insert
)

Calculates the start and end position for correctly inserting the proposal into the query.

public DefaultContentAssistProposals.Result
buildQuery(String
The JPQL query to modify with the given proposal
jpqlQuery
,
String
The proposal to insert into the query
proposal
,
int
The position of insertion
position
,
boolean
Flag that determines if the partial word following the cursor should be left intact or should be replaced by the proposal
insert
)

Implements org.eclipse.persistence.jpa.jpql.tools.ContentAssistProposals.buildQuery.

Creates a new JPQL query by inserting the given proposal at the given position.
public ResultQuery
buildXmlQuery(String
The JPQL query to modify with the given proposal, which should be the non- converted string, i.e. any escaped characters should not be converted
jpqlQuery
,
String
The proposal to insert into the query
proposal
,
int
The position of insertion, which was derived from the parsed tree representation of the JPQL query
position
,
boolean
Flag that determines if the partial word following the cursor should be left intact or should be replaced by the proposal
insert
)

Implements org.eclipse.persistence.jpa.jpql.tools.ContentAssistProposals.buildXmlQuery.

Creates a new JPQL query by inserting the given proposal at the given position.
public Iterable<String>
classNames()

Implements org.eclipse.persistence.jpa.jpql.tools.ContentAssistProposals.classNames.

Returns the filtered list of possible class names.
public Iterable<String>
columnNames()

Implements org.eclipse.persistence.jpa.jpql.tools.ContentAssistProposals.columnNames.

Returns the filtered list of possible column names.
public Iterable<ContentAssistProposals.EnumProposals>
enumConstant()

Implements org.eclipse.persistence.jpa.jpql.tools.ContentAssistProposals.enumConstant.

Returns the filtered list of possible enum constant names.
public IEntity
getAbstractSchemaType(String
The identification variable that, if defined as a range variable, will be mapped to a managed type
identificationVariable
)

Implements org.eclipse.persistence.jpa.jpql.tools.ContentAssistProposals.getAbstractSchemaType.

Retrieves the abstract schema type that is mapped with the given identification variable.
public String

Returns:

The prefix that is used to filter the list of class names or null if it was not set for the cursor position within the JPQL query
getClassNamePrefix
()

Returns the prefix that will be used to filter the list of possible class names.

public ContentAssistProposals.ClassType
public String

Returns:

The prefix that is used to filter the list of columns names, which is null if it has not been set along with the table name
getColumnNamePrefix
()

Returns the prefix that will be used by ContentAssistExtension to filter the column names if the table name is not null.

public JPQLGrammar

Returns:

The JPQLGrammar that was used to parse this Expression
getGrammar
()

Returns the JPQLGrammar that defines how the JPQL query was parsed.

public IdentifierRole
getIdentifierRole(String
The JPQL identifier to retrieve its role
identifier
)

Implements org.eclipse.persistence.jpa.jpql.tools.ContentAssistProposals.getIdentifierRole.

Returns the role of the given JPQL identifier.
public String

Returns:

The name of the table for which its column names should be retrieve as possible proposals
getTableName
()

Returns the table name that will be used by ContentAssistExtension to retrieve the column names.

public String

Returns:

The prefix that is used to filter the list of table names or null if it was not set for the cursor position within the JPQL query
getTableNamePrefix
()

Returns the prefix that will be used to filter the list of possible table names.

public boolean
hasProposals()

Implements org.eclipse.persistence.jpa.jpql.tools.ContentAssistProposals.hasProposals.

Determines whether there is at least one proposals.
public Iterable<String>
identificationVariables()

Implements org.eclipse.persistence.jpa.jpql.tools.ContentAssistProposals.identificationVariables.

Returns the collection of possible identification variables.
public Iterable<String>
identifiers()

Implements org.eclipse.persistence.jpa.jpql.tools.ContentAssistProposals.identifiers.

Returns the collection of possible JPQL identifiers.
protected void
public boolean

Returns:

true if the given proposal is a column name; false otherwise
isColumnName
(String
The proposal that is being inserted into the JPQL query
proposal
)

Determines whether the given proposal is a column name (which should be unqualified).

public boolean

Returns:

true if the given proposal is a unqualified enum constant name; false otherwise
isEnumConstant
(String
The proposal that is being inserted into the JPQL query
proposal
)

Determines whether the given proposal is an enum constant name (which should be unqualified).

public boolean

Returns:

true if the given proposal is a mapping name; false otherwise
isMappingName
(String
The proposal that is being inserted into the JPQL query
proposal
)

Determines whether the given proposal is a mapping name.

public String

Returns:

Either the given proposal if it's not a JPQL identifier or it does not have a longer form or the longest version of the JPQL identifier
longuestIdentifier
(String
The proposal to retrieve its longest form if one is associated with it
proposal
)

Returns the longest possible JPQL identifier that is related to the given proposal if the proposal is a JPQL identifier and contains multiple words.

public Iterable<IMapping>
mappings()

Implements org.eclipse.persistence.jpa.jpql.tools.ContentAssistProposals.mappings.

Returns the collection of possible mappings, which can be state fields, association fields and/or collection fields depending on the location used to retrieve the possible proposals.
protected void
removeIdentifier(String
The identifier that was added but actually needs to be removed
identifier
)

Removes the given JPQL identifier.

public void
setClassNamePrefix(String
The prefix that is used to filter the list of class names
prefix
,
ContentAssistProposals.ClassType
Determines how to filter the various types of classes
classType
)

Adds the given prefix that will be used to filter the list of possible class names.

public void
setTableName(String
The name of the table for which its column names should be retrieve as possible proposals
tableName
,
String
The prefix that is used to filter the list of columns names, which is never null but can be an empty string
prefix
)

Sets the table name and a prefix that will be used to filter the names of the table's columns.

public void
setTableNamePrefix(String
The prefix that is used to filter the list of columns names
tableNamePrefix
)

Adds the given prefix that will be used to filter the list of possible columns names.

public int
startPosition(WordParser wordParser, String proposal)

public Iterable<String>
tableNames()

Implements org.eclipse.persistence.jpa.jpql.tools.ContentAssistProposals.tableNames.

Returns the filtered list of possible table names.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait