Class Resolver
- java.lang.Object
-
- org.eclipse.persistence.jpa.jpql.tools.resolver.Resolver
-
- Direct Known Subclasses:
AbsFunctionResolver,AbstractPathResolver,ClassNameResolver,ClassResolver,CollectionEquivalentResolver,DeclarationResolver,EntityResolver,EnumLiteralResolver,FromSubqueryResolver,IdentificationVariableResolver,KeyResolver,NullResolver,NumericResolver,SubqueryEntityResolver,SumFunctionResolver,TreatResolver,ValueResolver
public abstract class Resolver extends java.lang.ObjectAResolveris responsible to resolve a property by retrieving either the managed type, the mapping, the type and the type declaration depending on the type of resolver.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.
- Version:
- 2.5
- Author:
- Pascal Filion
- Since:
- 2.3
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddChild(java.lang.String variableName, Resolver resolver)Caches the givenResolver.protected ITypebuildType()protected abstract ITypeDeclarationbuildTypeDeclaration()Resolves theITypeDeclarationof the property handled by thisResolver.protected voidcheckParent(Resolver parent)ResolvergetChild(java.lang.String variableName)Retrieves the child of thisResolverthat has the given variable name.IManagedTypegetManagedType()Returns theIManagedTypeassociated with the field handled by thisResolver.IMappinggetMapping()Returns theIMappingfor the wrapped field.ResolvergetParent()Returns the parent of thisResolver.IManagedTypegetParentManagedType()Returns the managed type of the parent resolver.IMappinggetParentMapping()Returns theIMappingof the parent resolver.ITypegetParentType()Returns the type of the parent resolver.ITypeDeclarationgetParentTypeDeclaration()Returns the type declaration of the parent resolver.IManagedTypeProvidergetProvider()Returns the provider of managed types.IQuerygetQuery()Returns the external form representing the JPQL query.ITypegetType()ITypegetType(java.lang.Class<?> type)Returns theITypeof the given Java type.ITypegetType(java.lang.String typeName)Retrieves the external class for the given fully qualified class name.ITypeDeclarationgetTypeDeclaration()Returns theITypeDeclarationof the field handled by thisResolver.TypeHelpergetTypeHelper()Returns a helper that gives access to the most commontypes.ITypeRepositorygetTypeRepository()Returns the type repository for the application.booleanisNullAllowed()Determines whether theExpressionto be created, which wraps the attribute or query key name allows the target of the 1:1 relationship to benullif there is no corresponding relationship in the database.voidsetNullAllowed(boolean nullAllowed)Sets whether theExpressionto be created, which wraps the attribute or query key name allows the target of the 1:1 relationship to benullif there is no corresponding relationship in the database.
-
-
-
Constructor Detail
-
Resolver
protected Resolver(Resolver parent)
Creates a newResolver.- Parameters:
parent- The parent of this resolver, which is nevernull- Throws:
java.lang.NullPointerException- If the parent isnull
-
-
Method Detail
-
addChild
public final void addChild(java.lang.String variableName, Resolver resolver)Caches the givenResolver.
-
buildType
protected IType buildType()
- Returns:
- Either the
ITypethat was resolved by thisResolveror theITypeforIType.UNRESOLVABLE_TYPEif it could not be resolved
-
buildTypeDeclaration
protected abstract ITypeDeclaration buildTypeDeclaration()
Resolves theITypeDeclarationof the property handled by thisResolver.- Returns:
- Either the
ITypeDeclarationthat was resolved by thisResolveror theITypeDeclarationforIType.UNRESOLVABLE_TYPEif it could not be resolved
-
checkParent
protected void checkParent(Resolver parent)
-
getChild
public final Resolver getChild(java.lang.String variableName)
Retrieves the child of thisResolverthat has the given variable name.- Parameters:
variableName- The name of the property that was cached- Returns:
- The cached
Resolvermapped with the given property name; otherwisenull
-
getManagedType
public IManagedType getManagedType()
Returns theIManagedTypeassociated with the field handled by thisResolver. If thisResolverdoes not handle a field that has aIManagedType, thennullshould be returned.For example: "
SELECT e FROM Employee e", theResolverfor e would be returning theIManagedTypefor Employee.- Returns:
- Either the
IManagedType, if it could be resolved;nullotherwise
-
getMapping
public IMapping getMapping()
Returns theIMappingfor the wrapped field.- Returns:
- Either the
IMappingornullif none exists
-
getParent
public Resolver getParent()
Returns the parent of thisResolver.- Returns:
- The parent of this
Resolver
-
getParentManagedType
public final IManagedType getParentManagedType()
Returns the managed type of the parent resolver.- Returns:
- The managed type of the parent resolver
-
getParentMapping
public final IMapping getParentMapping()
Returns theIMappingof the parent resolver.- Returns:
- The
IMappingof the parent resolver
-
getParentType
public final IType getParentType()
Returns the type of the parent resolver.- Returns:
- The type of the parent resolver
-
getParentTypeDeclaration
public final ITypeDeclaration getParentTypeDeclaration()
Returns the type declaration of the parent resolver.- Returns:
- The type declaration of the parent resolver
-
getProvider
public final IManagedTypeProvider getProvider()
Returns the provider of managed types.- Returns:
- The container holding the managed types
-
getQuery
public IQuery getQuery()
Returns the external form representing the JPQL query.- Returns:
- The external form of the JPQL query
-
getType
public final IType getType()
- Returns:
- Either the
ITypethat was resolved by thisResolveror theITypeforIType.UNRESOLVABLE_TYPEif it could not be resolved
-
getType
public final IType getType(java.lang.Class<?> type)
Returns theITypeof the given Java type.- Parameters:
type- The Java type for which its external form will be returned- Returns:
- The
ITyperepresenting the given Java type
-
getType
public final IType getType(java.lang.String typeName)
Retrieves the external class for the given fully qualified class name.- Parameters:
typeName- The fully qualified class name of the class to retrieve- Returns:
- The external form of the class to retrieve
-
getTypeDeclaration
public final ITypeDeclaration getTypeDeclaration()
Returns theITypeDeclarationof the field handled by thisResolver.- Returns:
- Either the
ITypeDeclarationthat was resolved by thisResolveror theITypeDeclarationforIType.UNRESOLVABLE_TYPEif it could not be resolved
-
getTypeHelper
public final TypeHelper getTypeHelper()
Returns a helper that gives access to the most commontypes.- Returns:
- A helper containing a collection of methods related to
IType
-
getTypeRepository
public final ITypeRepository getTypeRepository()
Returns the type repository for the application.- Returns:
- The repository of
ITypes
-
isNullAllowed
public boolean isNullAllowed()
Determines whether theExpressionto be created, which wraps the attribute or query key name allows the target of the 1:1 relationship to benullif there is no corresponding relationship in the database.- Returns:
trueto allownullif the corresponding relationship in the database does not exists;falseotherwise
-
setNullAllowed
public void setNullAllowed(boolean nullAllowed)
Sets whether theExpressionto be created, which wraps the attribute or query key name allows the target of the 1:1 relationship to benullif there is no corresponding relationship in the database.- Parameters:
nullAllowed-trueto allownullif the corresponding relationship in the database does not exists;falseotherwise
-
-