Package railo.runtime.type

Examples of railo.runtime.type.Array


    }
    return defaultValue;
  }

  public static String[] listToStringArray(String list, char delimiter) {
    Array array = ListUtil.listToArrayRemoveEmpty(list,delimiter);
    String[] arr=new String[array.size()];
        for(int i=0;i<arr.length;i++) {
            arr[i]=Caster.toString(array.get(i+1,""),"");
        }
        return arr;
  }
View Full Code Here


  protected static URLItem[] setFromTextPlain(String str) {
    return setFrom___(str, '\n');
  }
  protected static URLItem[] setFrom___(String tp,char delimiter) {
        if(tp==null) return new URLItem[0];
        Array arr=ListUtil.listToArrayRemoveEmpty(tp,delimiter);
        URLItem[] pairs=new URLItem[arr.size()];
       
        //Array item;
        int index;
        String name;
       
        for(int i=1;i<=pairs.length;i++) {
            name=Caster.toString(arr.get(i,""),"");
            //if(name.length()==0) continue;
           
            index=name.indexOf('=');
            if(index!=-1) pairs[i-1]=new URLItem(name.substring(0,index),name.substring(index+1),true);
            else pairs[i-1]=new URLItem(name,"",true);
View Full Code Here

            curr=parent.get(key,null);
        }
       
        if(curr==null) {
          if(isArrayDef) {
            Array arr = new ArrayImpl();
            arr.appendEL(value);
            parent.setEL(key,arr);
          }
            else parent.setEL(key,value);
        }
        else if(curr instanceof Array){
            ((Array) curr).appendEL(value);
        }
        else if(curr instanceof CastableStruct){
          if(isLast) ((CastableStruct)curr).setValue(value);
            else return (Struct) curr;
         
        }
        else if(curr instanceof Struct){
            if(isLast) parent.setEL(key,value);
            else return (Struct) curr;
        }
        else if(curr instanceof String){
            if(isArrayDef) {
              Array arr = new ArrayImpl();
              arr.appendEL(curr);
              arr.appendEL(value);
                parent.setEL(key,arr);
            }
            else if(value instanceof Struct) {
                parent.setEL(key,value);
            }
View Full Code Here

   * @param dc
   * @param sql
   * @throws PageException
   */
  public static void checkSQLRestriction(DatasourceConnection dc, SQL sql) throws PageException {
        Array sqlparts = ListUtil.listToArrayRemoveEmpty(
            SQLUtil.removeLiterals(sql.getSQLString())
            ," \t"+System.getProperty("line.separator"));

        //print.ln(List.toStringArray(sqlparts));
        DataSource ds = dc.getDatasource();
View Full Code Here

  public static QueryColumnImpl duplicate2QueryColumnImpl(QueryImpl targetQuery,QueryColumn col, boolean deepCopy) {
    if(col instanceof QueryColumnImpl)
        return ((QueryColumnImpl)col).cloneColumnImpl(deepCopy);
     
    // fill array for column
    Array content=new ArrayImpl();
    int len=col.size();
    for(int i=1;i<=len;i++){
      content.setEL(i, col.get(i,null));
    }
   
    // create and return column
    try {
      return new QueryColumnImpl(targetQuery,col.getKey(),content,col.getType());
View Full Code Here

        else if(format==UDF.RETURN_FORMAT_JSONfunc.set(KeyConstants._returnFormat, "json");
        else if(format==UDF.RETURN_FORMAT_SERIALIZE)func.set(KeyConstants._returnFormat, "cfml");
       
       
        FunctionArgument[] args =  udf.arguments;
        Array params=new ArrayImpl();
        //Object defaultValue;
        Struct m;
        //Object defaultValue;
        for(int y=0;y<args.length;y++) {
            StructImpl param=new StructImpl();
            param.set(KeyConstants._name,args[y].getName().getString());
            param.set(KeyConstants._required,Caster.toBoolean(args[y].isRequired()));
            param.set(KeyConstants._type,args[y].getTypeAsString());
            displayname=args[y].getDisplayName();
            if(!StringUtil.isEmpty(displayname)) param.set(KeyConstants._displayname,displayname);
           
            int defType = args[y].getDefaultType();
            if(defType==FunctionArgument.DEFAULT_TYPE_RUNTIME_EXPRESSION){
              param.set(KeyConstants._default, "[runtime expression]");
            }
            else if(defType==FunctionArgument.DEFAULT_TYPE_LITERAL){
              param.set(KeyConstants._default,
                  UDFUtil.getDefaultValue(pc, udf.pageSource, udf.index, y, null));
            }
           
            hint=args[y].getHint();
            if(!StringUtil.isEmpty(hint))param.set(KeyConstants._hint,hint);
            // TODO func.set("userMetadata", value); neo unterst゚tzt irgendwelche attr, die dann hier ausgebenen werden blレdsinn
           
            // meta data
            m=args[y].getMetaData();
            if(m!=null) StructUtil.copy(m, param, true);
               
            params.append(param);
        }
        func.set(KeyConstants._parameters,params);
    return func;
  }
View Full Code Here


  public static boolean[] toBooleanArray(Object obj) throws PageException {
    if(obj instanceof boolean[]) return (boolean[]) obj;
   
    Array arr = Caster.toArray(obj);
    boolean[] tarr=new boolean[arr.size()];
    for(int i=0;i<tarr.length;i++) {
      tarr[i]=Caster.toBooleanValue(arr.getE(i+1));
    }
    return tarr;
  }
View Full Code Here

  }

  public static byte[] toByteArray(Object obj) throws PageException {
    if(obj instanceof byte[]) return (byte[]) obj;
   
    Array arr = Caster.toArray(obj);
    byte[] tarr=new byte[arr.size()];
    for(int i=0;i<tarr.length;i++) {
      tarr[i]=Caster.toByteValue(arr.getE(i+1));
    }
    return tarr;
  }
View Full Code Here

  }
 
  public static short[] toShortArray(Object obj) throws PageException {
    if(obj instanceof short[]) return (short[]) obj;
   
    Array arr = Caster.toArray(obj);
    short[] tarr=new short[arr.size()];
    for(int i=0;i<tarr.length;i++) {
      tarr[i]=Caster.toShortValue(arr.getE(i+1));
    }
    return tarr;
  }
View Full Code Here

  }
 
  public static int[] toIntArray(Object obj) throws PageException {
    if(obj instanceof int[]) return (int[]) obj;
   
    Array arr = Caster.toArray(obj);
    int[] tarr=new int[arr.size()];
    for(int i=0;i<tarr.length;i++) {
      tarr[i]=Caster.toIntValue(arr.getE(i+1));
    }
    return tarr;
  }
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.