001/**
002 *
003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved.
004 *
005 * This library is free software; you can redistribute it and/or
006 * modify it under the terms of the GNU Lesser General Public
007 * License as published by the Free Software Foundation; either 
008 * version 2.1 of the License, or (at your option) any later version.
009 * 
010 * This library is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013 * Lesser General Public License for more details.
014 * 
015 * You should have received a copy of the GNU Lesser General Public 
016 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
017 * 
018 **/
019package lucee.runtime.type.ref;
020
021import lucee.runtime.PageContext;
022import lucee.runtime.exp.PageException;
023import lucee.runtime.type.Collection;
024/**
025 * 
026 */
027public interface Reference {
028
029        /**
030         * @return returns the value of the Variable
031         * @throws PageException
032         * @deprecated use instead <code>{@link #getKey()}</code>
033         */
034        public abstract String getKeyAsString() throws PageException;
035
036        /**
037         * @return returns the value of the Variable
038         * @throws PageException
039         */
040        public abstract Collection.Key getKey() throws PageException;
041
042    /**
043     * @param pc PageContext of the actuell Request
044     * @return returns the value of the Variable
045     * @throws PageException
046     */
047    public abstract Object get(PageContext pc) throws PageException;
048
049    /**
050     * @param pc PageContext of the actuell Request
051     * @return returns the value of the Variable
052     * @throws PageException
053     */
054    public abstract Object get(PageContext pc, Object defaultValue);
055
056        /**
057         * @param pc PageContext of the actuell Request
058         * @param value resets the value of the variable
059         * @return new Value setted
060         * @throws PageException
061         */
062        public abstract Object set(PageContext pc,Object value) throws PageException;
063
064        /**
065         * @param pc PageContext of the actuell Request
066         * @param value resets the value of the variable
067         * @return new Value setted
068         * @throws PageException
069         */
070        public abstract Object setEL(PageContext pc,Object value);
071
072    /**
073     * clears the variable from collection
074     * @param pc 
075     * @return removed Object
076     * @throws PageException
077     */
078    public abstract Object remove(PageContext pc) throws PageException;
079
080    /**
081     * clears the variable from collection
082     * @param pc 
083     * @return removed Object
084     * @throws PageException
085     */
086    public abstract Object removeEL(PageContext pc);
087
088    /**
089     * create it when not exist
090     * @param pc 
091     * @return removed Object
092     * @throws PageException
093     */
094    public abstract Object touch(PageContext pc) throws PageException;
095
096    /**
097     * create it when not exist
098     * @param pc 
099     * @return removed Object
100     * @throws PageException
101     */
102    public abstract Object touchEL(PageContext pc);
103    
104        /**
105         * @return returns the collection
106         */
107        public abstract Object getParent();
108}