public Value arg( com.mysema.query.types.Expression expression )
{
if ( expression instanceof Constant )
{
return new Value( literal( ((Constant) expression).getConstant() ) );
}
else if ( expression instanceof ParamExpression )
{
return new Value( param( ((ParamExpression) expression).getName() ) );
}
else if ( expression instanceof Path )
{
Path path = (Path) expression;
return new Value( identifier( path.getRoot() ).string( path.getMetadata().getElement()
.toString() ) );
}
else
{
throw new IllegalArgumentException( "Unknown argument type:" + expression );