Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright (c) 2009 Mysema Ltd.
  * All rights reserved.
  * 
  */
 package com.mysema.rdfbean.sesame.query;
 
import  org.openrdf.query.algebra.FunctionCall;
import  org.openrdf.query.algebra.Str;
import  org.openrdf.query.algebra.ValueExpr;
import  org.openrdf.query.algebra.Var;
CastTransformer provides

Author(s):
tiwe
Version:
$Id$
public class CastTransformer implements OperationTransformer{
    @Override
    public Collection<? extends Operator<?>> getSupportedOperations() {
        return Arrays.<Operator<?>>asList(..);
    }
    @Override
    public ValueExpr transform(Operation<?, ?> operationTransformerContext context) {
        ValueExpr arg1 = context.toValue(operation.getArg(0));
        
        if (operation.getOperator() == .){
            return new Str(arg1);   
        }else{
            ValueExpr arg2 = context.toValue(operation.getArg(1));
            return new FunctionCall( ((Var)arg2).getValue().stringValue(), arg1);    
        }        
        
    }
New to GrepCode? Check out our FAQ X