org.hibernate.query.sqm.tree.expression.function.SqmStrFunction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-core Show documentation
Show all versions of hibernate-core Show documentation
Hibernate's core ORM functionality
/*
* 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()
);
}
}