Class PersistenceExpressionSerializerContext<T>
java.lang.Object
com.blazebit.expression.persistence.PersistenceExpressionSerializerContext<T>
- Type Parameters:
T- The alias provider context type
- All Implemented Interfaces:
ExpressionSerializer.Context
public class PersistenceExpressionSerializerContext<T> extends Object implements ExpressionSerializer.Context
A simple implementation of a context for the
PersistenceExpressionSerializer.- Since:
- 1.0.0
- Author:
- Christian Beikov
-
Constructor Summary
Constructors Constructor Description PersistenceExpressionSerializerContext(ExpressionService expressionService, T aliasProviderContext)Creates a new persistence expression serializer context.PersistenceExpressionSerializerContext(ExpressionService expressionService, T aliasProviderContext, Map<String,Function<T,String>> aliasProviders)Creates a new persistence expression serializer context. -
Method Summary
Modifier and Type Method Description Map<String,String>getAliases()Returns the alias mappings from root alias to persistence query alias.Map<String,Function<T,String>>getAliasProviders()Returns the persistence query alias provider.<X> XgetContextParameter(String contextParameterName)Map<String,Object>getContextParameters()Returns the context parameters.ExpressionServicegetExpressionService()ExpressionInterpreter.ContextgetInterpreterContextForInlining()Returns the interpreter context that should be used for inlining of paths that have no persistence related renderers.Set<String>getPathsToInline()Returns the paths that should be inlined i.e. interpreted and rendered as constant.voidsetInterpreterContextForInlining(ExpressionInterpreter.Context interpreterContextForInlining)Sets the interpreter context to use for inlining of paths.voidsetPathsToInline(Set<String> pathsToInline)Sets the paths that should be inlined i.e. interpreted and rendered as constant.PersistenceExpressionSerializerContext<T>withAlias(String rootAlias, String queryAlias)Maps the given root alias to the given persistence query alias.PersistenceExpressionSerializerContext<T>withAliasProvider(String rootAlias, Function<T,String> aliasProvider)Maps the given root alias to the given persistence query alias provider.PersistenceExpressionSerializerContext<T>withContextParameter(String contextParameterName, Object value)Adds a context parameter with the given name and value.
-
Constructor Details
-
PersistenceExpressionSerializerContext
public PersistenceExpressionSerializerContext(ExpressionService expressionService, T aliasProviderContext)Creates a new persistence expression serializer context.- Parameters:
expressionService- The expression servicealiasProviderContext- The context for alias providers
-
PersistenceExpressionSerializerContext
public PersistenceExpressionSerializerContext(ExpressionService expressionService, T aliasProviderContext, Map<String,Function<T,String>> aliasProviders)Creates a new persistence expression serializer context.- Parameters:
expressionService- The expression servicealiasProviderContext- The context for alias providersaliasProviders- The persistence query alias providers
-
-
Method Details
-
withContextParameter
public PersistenceExpressionSerializerContext<T> withContextParameter(String contextParameterName, Object value)Adds a context parameter with the given name and value.- Parameters:
contextParameterName- The name of the context parameter to addvalue- The value- Returns:
thisfor method chaining
-
getContextParameters
Returns the context parameters.- Returns:
- the context parameters
-
withAlias
Maps the given root alias to the given persistence query alias.- Parameters:
rootAlias- The expression root aliasqueryAlias- The persistence query alias- Returns:
thisfor method chaining
-
getAliases
Returns the alias mappings from root alias to persistence query alias.- Returns:
- the alias mappings
-
withAliasProvider
public PersistenceExpressionSerializerContext<T> withAliasProvider(String rootAlias, Function<T,String> aliasProvider)Maps the given root alias to the given persistence query alias provider.- Parameters:
rootAlias- The expression root aliasaliasProvider- The persistence query alias provider- Returns:
thisfor method chaining
-
getAliasProviders
Returns the persistence query alias provider.- Returns:
- the persistence query alias provider
-
getInterpreterContextForInlining
Returns the interpreter context that should be used for inlining of paths that have no persistence related renderers.- Returns:
- the interpreter context for inlining
-
setInterpreterContextForInlining
public void setInterpreterContextForInlining(ExpressionInterpreter.Context interpreterContextForInlining)Sets the interpreter context to use for inlining of paths.- Parameters:
interpreterContextForInlining- The interpreter context
-
getPathsToInline
Returns the paths that should be inlined i.e. interpreted and rendered as constant.- Returns:
- the paths to inline
-
setPathsToInline
Sets the paths that should be inlined i.e. interpreted and rendered as constant.- Parameters:
pathsToInline- The paths to inline
-
getExpressionService
- Specified by:
getExpressionServicein interfaceExpressionSerializer.Context
-
getContextParameter
- Specified by:
getContextParameterin interfaceExpressionSerializer.Context
-