java.lang.Object
org.seasar.doma.jdbc.criteria.query.AliasManager
The
AliasManager class is responsible for managing alias mappings for entity and property
metamodels. It helps in generating and retrieving unique aliases for entities and their
associated properties to ensure consistency in database queries.
This class provides both static factory methods for instantiation and functionality to link to
a parent AliasManager to resolve aliases hierarchically.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Contextprotected final Map<EntityMetamodel<?>,String> protected final AliasManagerprotected final Map<PropertyMetamodel<?>,String> -
Constructor Summary
ConstructorsConstructorDescriptionAliasManager(Context context) Deprecated.AliasManager(Context context, AliasManager parent) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionprotected AliasManagerasParent()static AliasManagerCreates a new instance ofAliasManagerusing the provided configuration and context.static AliasManagercreateChild(Config config, Context context, AliasManager parent) Creates a child instance ofAliasManagerusing the provided configuration, context, and parentAliasManager.static AliasManagercreateEmpty(Config config, Context context) Creates an empty instance ofAliasManagerwith the provided configuration and context.getAlias(EntityMetamodel<?> entityMetamodel) Retrieves the alias corresponding to the givenEntityMetamodel.getAlias(PropertyMetamodel<?> propertyMetamodel) Retrieves the alias for the givenPropertyMetamodel.
-
Field Details
-
context
-
parent
-
entityAliasMap
-
propertyAliasMap
-
-
Constructor Details
-
AliasManager
Deprecated.Constructs an instance ofAliasManager.This constructor is marked as
@Deprecated. Usage ofof(Config, Context)orof(Config, Context, AliasManager)is recommended.- Parameters:
context- the context containing the entity metamodels; must not be null- Throws:
NullPointerException- ifcontextis null
-
AliasManager
Deprecated.Constructs an instance ofAliasManager.This constructor is marked as
@Deprecated. Usage ofof(Config, Context)orof(Config, Context, AliasManager)is recommended.- Parameters:
context- the context containing the entity metamodels; must not be nullparent- the parentAliasManager, or null if none- Throws:
NullPointerException- ifcontextis null
-
-
Method Details
-
getAlias
Retrieves the alias corresponding to the givenEntityMetamodel.- Parameters:
entityMetamodel- the entity metamodel for which the alias is to be retrieved; must not be null- Returns:
- the alias as a
String, ornullif no alias is found
-
getAlias
Retrieves the alias for the givenPropertyMetamodel.- Parameters:
propertyMetamodel- the property metamodel for which the alias is to be retrieved; must not be null- Returns:
- the alias as a
String, ornullif no alias is found
-
asParent
-
create
Creates a new instance ofAliasManagerusing the provided configuration and context.- Parameters:
config- the runtime configuration for DAOs; must not be nullcontext- the context containing the entity metamodels; must not be null- Returns:
- a new instance of
AliasManager - Throws:
NullPointerException- ifconfigorcontextis null
-
createEmpty
Creates an empty instance ofAliasManagerwith the provided configuration and context.- Parameters:
config- the runtime configuration for DAOs; must not be nullcontext- the context containing the entity metamodels; must not be null- Returns:
- a new instance of
EmptyAliasManagerwith a default aliasing strategy - Throws:
NullPointerException- ifconfigorcontextis null
-
createChild
Creates a child instance ofAliasManagerusing the provided configuration, context, and parentAliasManager.- Parameters:
config- the runtime configuration for DAOs; must not be nullcontext- the context containing the entity metamodels; must not be nullparent- the parentAliasManager; must not be null- Returns:
- a new child instance of
AliasManager - Throws:
NullPointerException- ifconfig,context, orparentis null
-