Package railo.runtime.type

Examples of railo.runtime.type.Array


   * @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

            return list;
        }
        else if(o instanceof Array) {
            if(!duplicate)return ArrayAsList.toList((Array)o);
          ArrayList list=new ArrayList();
            Array arr=(Array)o;
            for(int i=0;i<arr.size();i++)list.add(i,arr.get(i+1,null));
            return list;
        }
        else if(o instanceof Iterator) {
          Iterator it=(Iterator) o;
            ArrayList list=new ArrayList();
            while(it.hasNext()){
              list.add(it.next());
            }
            return list;
        }
        else if(o instanceof XMLStruct) {
            XMLStruct sct=((XMLStruct)o);
            if(sct instanceof XMLMultiElementStruct) return toList(new XMLMultiElementArray((XMLMultiElementStruct) o));
            ArrayList list=new ArrayList();
            list.add(sct);
            return list;
        }
        else if(o instanceof ObjectWrap) {
            return toList(((ObjectWrap)o).getEmbededObject());
        }
        else if(o instanceof Struct) {
            Struct sct=(Struct) o;
            ArrayList arr=new ArrayList();
           
            Iterator<Entry<Key, Object>> it = sct.entryIterator();
            Entry<Key, Object> e=null;
            try {
                while(it.hasNext()) {
                  e = it.next();
                    arr.add(toIntValue(e.getKey().getString()),e.getValue());
                }
            }
            catch (ExpressionException ee) {
                throw new ExpressionException("can't cast struct to a array, key ["+(e!=null?e.getKey():"")+"] is not a number");
            }
View Full Code Here

          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");
            }
View Full Code Here

    public static Object[] toNativeArray(Object o) throws PageException {
        if(o instanceof Object[]) {
            return (Object[])o;
        }
        else if(o instanceof Array) {
          Array arr=(Array)o;
          Object[] objs=new Object[arr.size()];
          for(int i=0;i<objs.length;i++) {
            objs[i]=arr.get(i+1, null);
          }
          return objs;
        }
        else if(o instanceof List) {
            return ((List) o).toArray();
        }
        else if(o instanceof XMLStruct) {
            XMLStruct sct=((XMLStruct)o);
            if(sct instanceof XMLMultiElementStruct) return toNativeArray((sct));
            Object[] a=new Object[1];
            a[0]=sct;
            return a;
        }
        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

        if(oRoles instanceof String) {
            oRoles=ListUtil.listToArrayRemoveEmpty(oRoles.toString(),",");
        }
       
        if(oRoles instanceof Array) {
            Array arrRoles = (Array) oRoles;
            String[] roles=new String[arrRoles.size()];
            for(int i=0;i<roles.length;i++) {
                roles[i]=Caster.toString(arrRoles.get(i+1,""));
            }
            return roles;
        }
        throw new ApplicationException("invalid roles definition for tag loginuser");
    }
View Full Code Here

      dec=Base64Coder.decodeToString(Caster.toString(encoded),"UTF-8");
    } catch (Exception e) {
      throw Caster.toPageException(e);
    }
     
      Array arr=ListUtil.listToArray(dec,""+ONE);
        int len=arr.size();
        if(len==3) {
          String str=Caster.toString(arr.get(3,""));
          if(str.startsWith("md5:")){
          if(!rolesDir.exists())rolesDir.mkdirs();
            str=str.substring(4);
            Resource md5 = rolesDir.getRealResource(str);
            try {
          str=IOUtil.toString(md5, "utf-8");
        } catch (IOException e) {
          str="";
        }
          }
         
          return new CredentialImpl(Caster.toString(arr.get(1,"")),Caster.toString(arr.get(2,"")),str,rolesDir);
        }
        if(len==2) return new CredentialImpl(Caster.toString(arr.get(1,"")),Caster.toString(arr.get(2,"")),rolesDir);
        if(len==1) return new CredentialImpl(Caster.toString(arr.get(1,"")),rolesDir);
       
        return null;
    }
View Full Code Here

        }
        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;
            }
View Full Code Here

                }
            }
           
           
            // Include MUST
            Array path = pc.getTemplatePath();
            //if(path.size()>1 ) {
            if(path.size()>1 && !(path.size()==3 && ListUtil.last(path.getE(2).toString(),"/\\",true).equalsIgnoreCase(railo.runtime.config.Constants.APP_CFC)) ) {// MUSTMUST bad impl -> check with and without application.cfc
             
              ComponentWrap c = ComponentWrap.toComponentWrap(Component.ACCESS_PRIVATE,ComponentUtil.toComponentAccess(component));
              Key[] keys = c.keys();
              Object el;
              Scope var = pc.variablesScope();
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.Array

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.