/** * Returns the type of the given {@link DatabaseMapping}, which is the persistent field type. * * @param mapping The {@link DatabaseMapping} to retrieve its persistent field type * @return The persistent field type */ Class<?> calculateMappingType(DatabaseMapping mapping) { return typeResolver().calculateMappingType(mapping); }
/** * Returns the type of the given {@link DatabaseMapping}, which is the persistent field type. * * @param mapping The {@link DatabaseMapping} to retrieve its persistent field type * @return The persistent field type */ Class<?> calculateMappingType(DatabaseMapping mapping) { return typeResolver().calculateMappingType(mapping); }
/** * {@inheritDoc} */ @Override public void visit(IdentificationVariable expression) { PathResolver resolver = pathResolver(); DatabaseMapping oldMapping = resolver.mapping; ClassDescriptor oldDescriptor = resolver.descriptor; try { resolver.mapping = null; resolver.descriptor = null; expression.accept(resolver); if (resolver.mapping != null) { type = calculateMappingType(resolver.mapping); } else if (resolver.descriptor != null) { type = resolver.descriptor.getJavaClass(); } else { type = Object.class; } } finally { resolver.mapping = oldMapping; resolver.descriptor = oldDescriptor; } }
/** * {@inheritDoc} */ @Override public void visit(IdentificationVariable expression) { PathResolver resolver = pathResolver(); DatabaseMapping oldMapping = resolver.mapping; ClassDescriptor oldDescriptor = resolver.descriptor; try { resolver.mapping = null; resolver.descriptor = null; expression.accept(resolver); if (resolver.mapping != null) { type = calculateMappingType(resolver.mapping); } else if (resolver.descriptor != null) { type = resolver.descriptor.getJavaClass(); } else { type = Object.class; } } finally { resolver.mapping = oldMapping; resolver.descriptor = oldDescriptor; } }
private Class<?> resolveMappingType(AbstractPathExpression expression) { PathResolver resolver = pathResolver(); QueryKey oldQueryKey = resolver.queryKey; DatabaseMapping oldMapping = resolver.mapping; ClassDescriptor oldDescriptor = resolver.descriptor; try { resolver.mapping = null; resolver.descriptor = null; resolver.queryKey = null; expression.accept(resolver); if (resolver.mapping != null) { return calculateMappingType(resolver.mapping); } else if (resolver.queryKey != null) { return calculateQueryKeyType(resolver.queryKey); } else { return queryContext.getEnumType(expression.toParsedText()); } } finally { resolver.mapping = oldMapping; resolver.queryKey = oldQueryKey; resolver.descriptor = oldDescriptor; } }
private Class<?> resolveMappingType(AbstractPathExpression expression) { PathResolver resolver = pathResolver(); QueryKey oldQueryKey = resolver.queryKey; DatabaseMapping oldMapping = resolver.mapping; ClassDescriptor oldDescriptor = resolver.descriptor; try { resolver.mapping = null; resolver.descriptor = null; resolver.queryKey = null; expression.accept(resolver); if (resolver.mapping != null) { return calculateMappingType(resolver.mapping); } else if (resolver.queryKey != null) { return calculateQueryKeyType(resolver.queryKey); } else { return queryContext.getEnumType(expression.toParsedText()); } } finally { resolver.mapping = oldMapping; resolver.queryKey = oldQueryKey; resolver.descriptor = oldDescriptor; } }
/** * {@inheritDoc} */ @Override public void visit(ValueExpression expression) { IdentificationVariable identificationVariable = (IdentificationVariable) expression.getExpression(); Declaration declaration = queryContext.findDeclaration(identificationVariable.getVariableName()); DatabaseMapping mapping = declaration.getMapping(); if (mapping.isDirectMapMapping()) { DirectMapMapping mapMapping = (DirectMapMapping) mapping; type = mapMapping.getValueClass(); if (type == null) { type = mapMapping.getDirectField().getType(); } } else { type = calculateMappingType(declaration.getMapping()); } }
/** * {@inheritDoc} */ @Override public void visit(ValueExpression expression) { IdentificationVariable identificationVariable = (IdentificationVariable) expression.getExpression(); Declaration declaration = queryContext.findDeclaration(identificationVariable.getVariableName()); DatabaseMapping mapping = declaration.getMapping(); if (mapping.isDirectMapMapping()) { DirectMapMapping mapMapping = (DirectMapMapping) mapping; type = mapMapping.getValueClass(); if (type == null) { type = mapMapping.getDirectField().getType(); } } else { type = calculateMappingType(declaration.getMapping()); } }