All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.query.sqm.tree.expression.function.SqmStrFunction Maven / Gradle / Ivy

There is a newer version: 7.0.0.Alpha3
Show newest version
/*
 * Hibernate, Relational Persistence for Idiomatic Java
 *
 * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
 * See the lgpl.txt file in the root directory or .
 */
package org.hibernate.query.sqm.tree.expression.function;

import java.util.Locale;

import org.hibernate.metamodel.model.domain.spi.AllowableFunctionReturnType;
import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
import org.hibernate.query.sqm.tree.expression.SqmExpression;

/**
 * @author Chris Cranford
 */
public class SqmStrFunction extends AbstractSqmFunction {
	public static final String NAME = "str";

	private final SqmExpression argument;

	public SqmStrFunction(SqmExpression argument, AllowableFunctionReturnType resultType) {
		super( resultType );
		this.argument = argument;
	}

	public SqmExpression getArgument() {
		return argument;
	}

	@Override
	public String getFunctionName() {
		return NAME;
	}

	@Override
	public boolean hasArguments() {
		return true;
	}

	@Override
	public  T accept(SemanticQueryWalker walker) {
		return walker.visitStrFunction( this );
	}

	@Override
	public String asLoggableText() {
		return String.format(
				Locale.ROOT,
				"%s( %s )",
				NAME,
				argument.asLoggableText()
		);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy