Package railo.runtime.type

Examples of railo.runtime.type.FunctionValueImpl


    public static Struct toFunctionValues(Object[] args, int offset, int len) throws ExpressionException {
      // TODO nicht sehr optimal
        Struct sct=new StructImpl(StructImpl.TYPE_LINKED);
        for(int i=offset;i<offset+len;i++) {
            if(args[i] instanceof FunctionValueImpl){
                FunctionValueImpl value = (FunctionValueImpl) args[i];
                sct.setEL(value.getNameAsKey(),value.getValue());
            }
            else throw new ExpressionException("Missing argument name, when using named parameters to a function, every parameter must have a name ["+i+":"+args[i].getClass().getName()+"].");
        }
        return sct;
    }
View Full Code Here


      Iterator<Entry<Key, Object>> it = args.entryIterator();
        Entry<Key, Object> e;
        List<FunctionValue> fvalues=new ArrayList<FunctionValue>();
        while(it.hasNext()) {
          e=it.next();
          fvalues.add(new FunctionValueImpl(e.getKey().getString(),e.getValue()));
        }
        return fvalues.toArray(new FunctionValue[fvalues.size()]);
    }
View Full Code Here

            Iterator<FunctionLibFunctionArg> it = args.iterator();
            FunctionLibFunctionArg arg;
            while(it.hasNext()){
              arg=it.next();
              if(arg.getDefaultValue()!=null)
                tmp.add(new FunctionValueImpl(arg.getName(),arg.getDefaultValue()));
            }
            for(int i=0;i<arguments.length;i++){
              tmp.add(arguments[i]);
            }
            arguments=tmp.toArray();
View Full Code Here

   
    @Override
    public Object getValue(PageContext pc) throws PageException {
       
        if(name instanceof Variable){
          return new FunctionValueImpl(toStringArray(pc,(Set)name),refValue==null?objValue:refValue.getValue(pc));
        }
        if(name instanceof Literal) {
          return new FunctionValueImpl(((Literal)name).getString(pc),refValue==null?objValue:refValue.getValue(pc));
        }
       
        // TODO no idea if this is ever used
        if(name instanceof Set){
          return new FunctionValueImpl(railo.runtime.type.util.ListUtil.arrayToList(toStringArray(pc,(Set)name),"."),refValue==null?objValue:refValue.getValue(pc));
        }
        throw new InterpreterException("invalid syntax in named argument");
        //return new FunctionValueImpl(key,value.getValue());
    }
View Full Code Here

  }
 
 
  protected static Struct _call(Object[] objArr,String expMessage) throws PageException {
    Struct sct=new StructImpl();
    FunctionValueImpl fv;
    for(int i=0;i<objArr.length;i++) {
      if(objArr[i] instanceof FunctionValue) {
        fv=((FunctionValueImpl)objArr[i]);
        if(fv.getNames()==null) {
          sct.set(fv.getNameAsKey(),fv.getValue());
        }
        else {
          String[] arr = fv.getNames();
          Struct s=sct;
          for(int y=0;y<arr.length-1;y++) {
            s=touch(s,arr[y]);
          }
          s.set(KeyImpl.init(arr[arr.length-1]), fv.getValue())
        }
      }
      else {
        throw new ExpressionException(expMessage);
      }
View Full Code Here

TOP

Related Classes of railo.runtime.type.FunctionValueImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.