Package railo.runtime.type

Examples of railo.runtime.type.ArrayImpl


  public static Array call(PageContext pc, Query query, String columnName) throws PageException {
    return call(pc, query, columnName, null);
  }
  public static Array call(PageContext pc, Query query, String columnName,  UDF udf) throws PageException {
    Array arr=new ArrayImpl();
    QueryColumn column = query.getColumn(KeyImpl.init(columnName));
      Iterator<Object> it = column.valueIterator();
      Object value;
    while(it.hasNext()) {
      value=it.next();
      if(!NullSupportHelper.full() && value==null) value="";
      if(udf!=null)arr.append(udf.call(pc, new Object[]{value}, true));
      else arr.append(value);
    }
    return arr;   
  }
View Full Code Here


   * @param el Struct Object as XML Element
   * @return Struct Object
   * @throws ConverterException
   */
  private Array _deserializeArray(Element el) throws ConverterException {
    Array array=new ArrayImpl();
   
    NodeList list=el.getChildNodes();
    int len=list.getLength();
    for(int i=0;i<len;i++) {
      Node node=list.item(i);
      if(node instanceof Element)
        try {
          array.append(_deserialize((Element)node));
        } catch (PageException e) {
          throw toConverterException(e);
        }
     
    }
View Full Code Here

  }

  public Array getData(PageContext pc) {
   
    Iterator<Struct> it = queue.iterator();
    Array arr=new ArrayImpl();
    while(it.hasNext()){
      arr.appendEL(it.next());
    }
    return arr;
  }
View Full Code Here

      Variant[] varr = variant.getVariantArrayRef();
      Object[] oarr = new Object[varr.length];
      for(int i=0;i<varr.length;i++) {
        oarr[i]=toObject(parent,varr[i],Caster.toString(i));
      }
      return new ArrayImpl(oarr);
    }
    else if(type==Variant.VariantDispatch) {
       
        return new COMObject(variant,variant.toDispatch(),parent.getName()+"."+key);
    }
View Full Code Here

                headers[ i ] = "COLUMN_" + ( i + 1 );
        }

        Array[] arrays = new Array[ numCols ]// create column Arrays
        for( int i=0; i < numCols; i++ )
            arrays[ i ] = new ArrayImpl();

        while ( curRow < numRows ) {

            row = allRows.get( curRow++ );
View Full Code Here

        v=it.next();
          // UDF
        if(v instanceof UDF) {
          udf=(UDF) v;
            sctUDF=new StructImpl();
            arrArg=new ArrayImpl();
            udfs.setEL(udf.getFunctionName(), sctUDF);
            args = udf.getFunctionArguments();
            for(int i=0;i<args.length;i++){
              sctArg=new StructImpl();
              arrArg.appendEL(sctArg);
View Full Code Here

     * @throws PageException
     */
    public static Array toArray(Object o) throws PageException {
      if(o instanceof Array) return (Array)o;
        else if(o instanceof Object[]) {
            return new ArrayImpl((Object[])o);
        }
        else if(o instanceof List) {
            return ListAsArray.toArray((List)o);//new ArrayImpl(((List) o).toArray());
        }
        else if(o instanceof Set) {
         
            return toArray(((Set)o).toArray());//new ArrayImpl(((List) o).toArray());
        }
        else if(o instanceof XMLStruct) {
          XMLMultiElementStruct xmes;
          if(o instanceof XMLMultiElementStruct) {
            xmes=(XMLMultiElementStruct)o;
          }
          else {
            XMLStruct sct=(XMLStruct) o;
              Array a=new ArrayImpl();
              a.append(o);
              xmes=new XMLMultiElementStruct(a, sct.getCaseSensitive());
          }
        return new XMLMultiElementArray(xmes);
        }
        else if(o instanceof ObjectWrap) {
            return toArray(((ObjectWrap)o).getEmbededObject());
        }
        else if(o instanceof Struct) {
            Struct sct=(Struct) o;
            Array arr=new ArrayImpl();
           
            Iterator<Entry<Key, Object>> it = sct.entryIterator();
            Entry<Key, Object> e=null;
            try {
                while(it.hasNext()) {
                  e = it.next();
                    arr.setE(toIntValue(e.getKey().getString()),e.getValue());
                }
            }
            catch (ExpressionException ee) {
                throw new ExpressionException("can't cast struct to a array, key ["+e.getKey().getString()+"] is not a number");
            }
            return arr;
        }
        else if(o instanceof boolean[])return new ArrayImpl(ArrayUtil.toReferenceType((boolean[])o));
        else if(o instanceof byte[])return new ArrayImpl(ArrayUtil.toReferenceType((byte[])o));
        else if(o instanceof char[])return new ArrayImpl(ArrayUtil.toReferenceType((char[])o));
        else if(o instanceof short[])return new ArrayImpl(ArrayUtil.toReferenceType((short[])o));
        else if(o instanceof int[])return new ArrayImpl(ArrayUtil.toReferenceType((int[])o));
        else if(o instanceof long[])return new ArrayImpl(ArrayUtil.toReferenceType((long[])o));
        else if(o instanceof float[])return new ArrayImpl(ArrayUtil.toReferenceType((float[])o));
        else if(o instanceof double[])return new ArrayImpl(ArrayUtil.toReferenceType((double[])o));
       
        throw new CasterException(o,"Array");
    }
View Full Code Here

        else if(o instanceof ObjectWrap) {
            return toNativeArray(((ObjectWrap)o).getEmbededObject());
        }
        else if(o instanceof Struct) {
            Struct sct=(Struct) o;
            Array arr=new ArrayImpl();
           
            Iterator<Entry<Key, Object>> it = sct.entryIterator();
            Entry<Key, Object> e=null;
            try {
                while(it.hasNext()) {
                  e=it.next();
                    arr.setE(toIntValue(e.getKey().getString()),e.getValue());
                }
            }
            catch (ExpressionException ee) {
                throw new ExpressionException("can't cast struct to a array, key ["+e.getKey()+"] is not a number");
            }
View Full Code Here

     * @return casted Array
     */
    public static Array toArray(Object o, Array defaultValue) {
        if(o instanceof Array) return (Array)o;
        else if(o instanceof Object[]) {
            return new ArrayImpl((Object[])o);
        }
        else if(o instanceof List) {
            return new ArrayImpl(((List) o).toArray());
        }
        else if(o instanceof XMLStruct) {
            Array arr = new ArrayImpl();
            arr.appendEL(o);
            return arr;
        }
        else if(o instanceof ObjectWrap) {
            return toArray(((ObjectWrap)o).getEmbededObject(defaultValue),defaultValue);
            //if(io!=null)return toArray(io,defaultValue);
        }
        else if(o instanceof Struct) {
            Struct sct=(Struct) o;
            Array arr=new ArrayImpl();
           
            Iterator<Entry<Key, Object>> it = sct.entryIterator();
            Entry<Key, Object> e=null;
            try {
                while(it.hasNext()) {
                  e=it.next();
                    arr.setEL(toIntValue(e.getKey().getString()),e.getValue());
                }
            }
            catch (ExpressionException ee) {
                return defaultValue;
            }
            return arr;
        }
        else if(o instanceof boolean[])return new ArrayImpl(ArrayUtil.toReferenceType((boolean[])o));
        else if(o instanceof byte[])return new ArrayImpl(ArrayUtil.toReferenceType((byte[])o));
        else if(o instanceof char[])return new ArrayImpl(ArrayUtil.toReferenceType((char[])o));
        else if(o instanceof short[])return new ArrayImpl(ArrayUtil.toReferenceType((short[])o));
        else if(o instanceof int[])return new ArrayImpl(ArrayUtil.toReferenceType((int[])o));
        else if(o instanceof long[])return new ArrayImpl(ArrayUtil.toReferenceType((long[])o));
        else if(o instanceof float[])return new ArrayImpl(ArrayUtil.toReferenceType((float[])o));
        else if(o instanceof double[])return new ArrayImpl(ArrayUtil.toReferenceType((double[])o));
       
        return defaultValue;
    }
View Full Code Here

       
        // <type>[]
        if(type.endsWith("[]")){
          String componentType = type.substring(0,type.length()-2);
          Object[] src = toNativeArray(o);
          Array trg=new ArrayImpl();
          for(int i=0;i<src.length;i++){
            if(src[i]==null){
              continue;
            }
            trg.setE(i+1,castTo(pc, componentType, src[i],alsoPattern));
          }         
          return trg; 
        }
       
       
View Full Code Here

TOP

Related Classes of railo.runtime.type.ArrayImpl

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.