Package railo.runtime.exp

Examples of railo.runtime.exp.ExpressionException


        other=((ComponentAccess)c).keys(access);
      else
        other=CollectionUtil.keys(c);
     
      if(other.length==0)
        return new ExpressionException(
            "component ["+c.getCallName()+"] has no "+strAccess+" function with name ["+key+"]");
     
      return new ExpressionException(
          "component ["+c.getCallName()+"] has no "+strAccess+" function with name ["+key+"]",
          "accessible functions are ["+ListUtil.arrayToList(other,",")+"]");
    }
    return new ExpressionException("member ["+key+"] of component ["+c.getCallName()+"] is not a function", "Member is of type ["+Caster.toTypeName(member)+"]");
  }
View Full Code Here


  }

  public static ComponentAccess toComponentAccess(Component comp) throws ExpressionException {
    ComponentAccess ca = toComponentAccess(comp, null);
    if(ca!=null) return ca;
    throw new ExpressionException("can't cast class ["+Caster.toClassName(comp)+"] to a class of type ComponentAccess");
  }
View Full Code Here

 
 
 
  public static Component toComponent(Object obj) throws ExpressionException {
    if(obj instanceof Component) return (Component) obj;
    throw new ExpressionException("can't cast class ["+Caster.toClassName(obj)+"] to a class of type Component");
  }
View Full Code Here

  }

  @Override
  public Object set(Collection.Key key, Object value) throws PageException {
    if(isReadOnlyKey(key))
      throw new ExpressionException("you can't rewrite key ["+key+"] from server scope, key is readonly");
    return super.set (key, value);
  }
View Full Code Here

   */
  public static void swap(Array array, int left, int right) throws ExpressionException {
    int len=array.size();
   
    if(len==0)
      throw new ExpressionException("array is empty");
    if(left<1 || left>len)
      throw new ExpressionException("invalid index ["+left+"]","valid indexes are from 1 to "+len);
    if(right<1 || right>len)
      throw new ExpressionException("invalid index ["+right+"]","valid indexes are from 1 to "+len);
   
   
    try {
      Object leftValue=array.get(left,null);
      Object rightValue=array.get(right,null);
     
      array.setE(left,rightValue);
      array.setE(right,leftValue);
    } catch (PageException e) {
      throw new ExpressionException("can't swap values of array",e.getMessage());
    }
   
  }
View Full Code Here

   * @return sum of all values
   * @throws ExpressionException
  */
  public static double sum(Array array) throws ExpressionException {
    if(array.getDimension()>1)
      throw new ExpressionException("can only get sum/avg from 1 dimensional arrays");
   
    double rtn=0;
    int len=array.size();
    //try {     
      for(int i=1;i<=len;i++) {
View Full Code Here

    return rtn;
  }
 
  private static double _toDoubleValue(Array array, int i) throws ExpressionException {
    Object obj = array.get(i,null);
    if(obj==null)throw new ExpressionException("there is no element at position ["+i+"] or the element is null");
    double tmp = Caster.toDoubleValue(obj,Double.NaN);
    if(Double.isNaN(tmp))
      throw new CasterException(obj,Double.class);
    return tmp;
  }
View Full Code Here

   * @return the smallest value
   * @throws PageException
  */
  public static double min(Array array) throws PageException {
    if(array.getDimension()>1)
      throw new ExpressionException("can only get max value from 1 dimensional arrays");
    if(array.size()==0) return 0;
   
    double rtn=_toDoubleValue(array,1);
    int len=array.size();
    try {
      for(int i=2;i<=len;i++) {
        double v=_toDoubleValue(array,i);
        if(rtn>v)rtn=v;
       
      }
    } catch (PageException e) {
      throw new ExpressionException("exception while execute array operation: "+e.getMessage());
    }
    return rtn;
  }
View Full Code Here

   * @return the greatest value
   * @throws PageException
  */
  public static double max(Array array) throws PageException {
    if(array.getDimension()>1)
      throw new ExpressionException("can only get max value from 1 dimensional arrays");
    if(array.size()==0) return 0;
   
    double rtn=_toDoubleValue(array,1);
    int len=array.size();
    try {
      for(int i=2;i<=len;i++) {
        double v=_toDoubleValue(array,i);
        if(rtn<v)rtn=v;
       
      }
    } catch (PageException e) {
      throw new ExpressionException("exception while execute array operation: "+e.getMessage());
    }
    return rtn;
  }
View Full Code Here

  public static Comparator toComparator(PageContext pc,String sortType, String sortOrder, boolean localeSensitive) throws PageException {
    // check sortorder
    boolean isAsc=true;
    if(sortOrder.equalsIgnoreCase("asc"))isAsc=true;
    else if(sortOrder.equalsIgnoreCase("desc"))isAsc=false;
    else throw new ExpressionException("invalid sort order type ["+sortOrder+"], sort order types are [asc and desc]");
   
    // text
    if(sortType.equalsIgnoreCase("text")) {
      if(localeSensitive)return toCollator(pc,Collator.IDENTICAL);
      return new TextComparator(isAsc,false);
    }
    // text no case
    else if(sortType.equalsIgnoreCase("textnocase")) {
      if(localeSensitive)return toCollator(pc,Collator.TERTIARY);
      return new TextComparator(isAsc,true);
    }
    // numeric
    else if(sortType.equalsIgnoreCase("numeric")) {
      return new NumberComparator(isAsc);
    }
    else {
      throw new ExpressionException("invalid sort type ["+sortType+"], sort types are [text, textNoCase, numeric]");
   
  }
View Full Code Here

TOP

Related Classes of railo.runtime.exp.ExpressionException

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.