public class AliasResolver extends Object
| Constructor and Description |
|---|
AliasResolver() |
| Modifier and Type | Method and Description |
|---|---|
String |
createAliasForEmbedded(String entityAlias,
List<String> propertyPathWithoutAlias,
boolean optionalMatch)
Given the path to an embedded property, it will create an alias to use in the query for the embedded containing
the property.
|
String |
findAliasForEmbedded(String entityAlias,
List<String> propertyPathWithoutAlias)
Given the alias of the entity and the path to the embedded properties it will return the alias
of the embedded component containing the property.
|
String |
findAliasForType(String entityType) |
EmbeddedAliasTree |
getAliasTree(String entityAlias)
Given the alias of the entity it will return a tree structure containing all the aliases for the embedded
properties of the entity.
|
boolean |
isOptionalMatch(String alias)
Tells if the alias has to be used in the OPTIONAL MATCH part of the query.
|
void |
registerEntityAlias(String entityName,
String alias) |
public String createAliasForEmbedded(String entityAlias, List<String> propertyPathWithoutAlias, boolean optionalMatch)
The alias will be saved and can be returned using the method findAliasForEmbedded(String, List).
For example, using n as entity alias and [embedded, anotherEmbedded, property] as path to the property will return "n_2" as alias for "n.embedded.anotherEmbedded".
entityAlias - the alias of the entity that contains the embeddedpropertyPathWithoutAlias - the path to the property without the aliasoptionalMatch - if true, the alias does not represetn a required match in the query (It will appear in the OPTIONAL MATCH clause)public String findAliasForEmbedded(String entityAlias, List<String> propertyPathWithoutAlias)
entityAlias - the alias of the entity that contains the embeddedpropertyPathWithoutAlias - the path to the property without the aliascreateAliasForEmbedded(String, List, boolean)public EmbeddedAliasTree getAliasTree(String entityAlias)
The tree has the entity alias as root and the embedded alias as children. For example, a path to two properties like:
n (alias = n)|- first (alias = _n1) -- anotherEmbedded (alias = _n2)
|
-- second (alias = _n3) -- anotherEmbedded (alias = _n4)
entityAlias - the alias of the entity that contains the embeddedEmbeddedAliasTree or nullpublic boolean isOptionalMatch(String alias)
alias - the alis to checktrue if the alias should be used in OPTIONAL MATCH part of the query, false otherwiseCopyright © 2010-2015 Hibernate. All Rights Reserved.