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;
020
021import lucee.runtime.PageContext;
022import lucee.runtime.dump.Dumpable;
023import lucee.runtime.exp.PageException;
024import lucee.runtime.op.Castable;
025
026/**
027 * Hold a native or wild object, to use id inside lucee runtime
028 */
029public interface Objects extends Dumpable,Castable      {
030    
031    /**
032     * return property 
033     * @param pc PageContext
034     * @param key Name of the Property
035     * @return return value of the Property
036     */
037    public Object get(PageContext pc, Collection.Key key, Object defaultValue);
038    
039    
040    /**
041     * return property or getter of the ContextCollection
042     * @param pc PageContext
043     * @param key Name of the Property
044     * @return return value of the Property
045     * @throws PageException
046     */
047    public Object get(PageContext pc, Collection.Key key) throws PageException;
048    
049    
050
051    /**
052     * sets a property (Data Member) value of the object
053     * @param pc 
054     * @param propertyName property name to set 
055     * @param value value to insert
056     * @return value set to property
057     * @throws PageException
058     */
059    public Object set(PageContext pc, Collection.Key propertyName, Object value) throws PageException;
060
061
062    /**
063     * sets a property (Data Member) value of the object
064     * @param pc 
065     * @param propertyName property name to set 
066     * @param value value to insert
067     * @return value set to property
068     */
069    public Object setEL(PageContext pc, Collection.Key propertyName, Object value);
070
071    /**
072     * calls a method of the object
073     * @param pc 
074     * @param methodName name of the method to call
075     * @param arguments arguments to call method with
076     * @return return value of the method
077     * @throws PageException
078     */
079    public Object call(PageContext pc, Collection.Key methodName, Object[] arguments) throws PageException;
080    
081    
082    /**
083     * call a method of the Object with named arguments
084     * @param pc PageContext
085     * @param methodName name of the method
086     * @param args Named Arguments for the method
087     * @return return result of the method
088     * @throws PageException
089     */
090    public abstract Object callWithNamedValues(PageContext pc, Collection.Key methodName, Struct args) throws PageException;
091}