001 package railo.runtime.util; 002 003 import railo.runtime.PageContext; 004 import railo.runtime.exp.PageException; 005 006 /** 007 * Variable Util 008 */ 009 public interface VariableUtil { 010 011 /** 012 * return a property from the given Object, when property doesn't exists return null 013 * @param pc 014 * @param coll Collection to check 015 * @param key to get from Collection 016 * @return value or null 017 */ 018 public abstract Object getCollection(PageContext pc, Object coll, 019 String key, Object defaultValue); 020 021 /** 022 * return a property from the given Object, when property doesn't exists return null 023 * @param pc 024 * @param coll Collection to check 025 * @param key to get from Collection 026 * @return value or null 027 */ 028 public abstract Object get(PageContext pc, Object coll, String key, Object defaultValue); 029 030 /** 031 * return a property from the given Object, when property doesn't exists return null 032 * @param pc 033 * @param coll Collection to check 034 * @param key to get from Collection 035 * @return value or null 036 */ 037 public abstract Object getLight(PageContext pc, Object coll, String key, Object defaultValue); 038 039 /** 040 * return a property from the given Object, when coll is a query return a Column,when property doesn't exists throw exception 041 * @param pc 042 * @param coll Collection to check 043 * @param key to get from Collection 044 * @return value value to get 045 * @throws PageException 046 */ 047 public abstract Object getCollection(PageContext pc, Object coll, String key) 048 throws PageException; 049 050 /** 051 * return a property from the given Object, when property doesn't exists throw exception 052 * @param pc 053 * @param coll Collection to check 054 * @param key to get from Collection 055 * @return value value to get 056 * @throws PageException 057 */ 058 public abstract Object get(PageContext pc, Object coll, String key) 059 throws PageException; 060 061 /** 062 * sets a value to the Object 063 * @param pc 064 * @param coll Collection to check 065 * @param key to get from Collection 066 * @param value Value to set 067 * @return value setted 068 * @throws PageException 069 */ 070 public abstract Object set(PageContext pc, Object coll, String key, 071 Object value) throws PageException; 072 073 /** 074 * sets a value to the Object 075 * @param pc 076 * @param coll Collection to check 077 * @param key to get from Collection 078 * @param value Value to set 079 * @return value setted or null if can't set 080 */ 081 public abstract Object setEL(PageContext pc, Object coll, String key, 082 Object value); 083 084 /** 085 * remove value from Collection 086 * @param coll 087 * @param key 088 * @return has cleared or not 089 */ 090 public abstract Object removeEL(Object coll, String key); 091 092 /** 093 * clear value from Collection 094 * @param coll 095 * @param key 096 * @return has cleared or not 097 * @throws PageException 098 */ 099 public abstract Object remove(Object coll, String key) throws PageException; 100 101 /** 102 * call a Function (UDF, Method) with or witout named values 103 * @param pc 104 * @param coll Collection of the UDF Function 105 * @param key name of the function 106 * @param args arguments to call the function 107 * @return return value of the function 108 * @throws PageException 109 */ 110 public abstract Object callFunction(PageContext pc, Object coll, 111 String key, Object[] args) throws PageException; 112 113 /** 114 * call a Function (UDF, Method) without Named Values 115 * @param pc 116 * @param coll Collection of the UDF Function 117 * @param key name of the function 118 * @param args arguments to call the function 119 * @return return value of the function 120 * @throws PageException 121 */ 122 public abstract Object callFunctionWithoutNamedValues(PageContext pc, 123 Object coll, String key, Object[] args) throws PageException; 124 125 /** 126 * call a Function (UDF, Method) with Named Values 127 * @param pc 128 * @param coll Collection of the UDF Function 129 * @param key name of the function 130 * @param args arguments to call the function 131 * @return return value of the function 132 * @throws PageException 133 */ 134 public abstract Object callFunctionWithNamedValues(PageContext pc, 135 Object coll, String key, Object[] args) throws PageException; 136 137 }