/*
 * BeanContext.java  $Revision: 1.2 $  $Date: 2007/10/03 04:39:40 $
 *
 * Copyright (C) 2007 Meldcraft Corporation
 *
 * This file is part of Scaffold.
 * 
 * Scaffold is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Scaffold is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with Scaffold.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.meldcraft.application.util;

import com.meldcraft.application.ApplicationContext;
import com.meldcraft.util.ScriptExpander;

/**
 * @version $Revision: 1.2 $ $Date: 2007/10/03 04:39:40 $
 * @author Rob Richards
 */
public class BeanContext
{
    private ApplicationContext  mApplicationContext;
    private Object              mThisTarget;
    private Object              mTarget;
    private Object              mValue;
    private ScriptExpander      mScriptExpander;
    private String              mTargetProperty;
    private String              mTargetElementId;

    public BeanContext(String targetElementId, ApplicationContext applicationContext, Object target, Object value)
    {
        this(applicationContext, target, target, value);
        mTargetElementId = targetElementId;
    }

    public BeanContext(String elementId, ApplicationContext context, Object thisTarget, Object target, Object value, String property)
    {
        this(context, thisTarget, target, value, property);
        mTargetElementId = elementId;
    }

    public BeanContext(ApplicationContext applicationContext, Object target, Object value)
    {
        this(applicationContext, target, target, value);
    }

    public BeanContext(ApplicationContext applicationContext, Object thisTarget, Object target, Object value)
    {
        this(applicationContext, thisTarget, target, value, (String)null);
    }

    public BeanContext(ApplicationContext applicationContext, Object thisTarget, Object target, Object value, String targetProperty)
    {
        this(applicationContext, thisTarget, target, value, new ScriptExpander(), targetProperty);
    }

    public BeanContext(ApplicationContext applicationContext, Object thisTarget, Object target, Object value, ScriptExpander scriptExpander)
    {
        this(applicationContext, thisTarget, target, value, scriptExpander, null);
    }

    public BeanContext(ApplicationContext applicationContext, Object thisTarget, Object target, Object value, ScriptExpander scriptExpander, String targetProperty)
    {
        mApplicationContext = applicationContext;
        mThisTarget = thisTarget;
        mTarget = target;
        mValue = value;
        mScriptExpander = scriptExpander;
        mTargetProperty = targetProperty;
    }

    public ApplicationContext getApplicationContext()
    {
        return mApplicationContext;
    }

    public ScriptExpander getScriptExpander()
    {
        return mScriptExpander;
    }

    public Object getTarget()
    {
        return mTarget;
    }

    public String getTargetElementId()
    {
        return mTargetElementId;
    }

    public String getTargetProperty()
    {
        return mTargetProperty;
    }

    public Object getThisTarget()
    {
        return mThisTarget;
    }

    public Object getValue()
    {
        return mValue;
    }
}



