ProspectDirector.Web.UI.Packagers.PackagerValueHandler =
Class.extend({

    //================================
    // FIELDS
    //================================

    _context: null,
    _command: null,
    _errors: null,
    _valueProvider: null,

    //================================
    // CONSTRUCTOR
    //================================

    init: function (options) {
        this._context = options.context;
        this._command = options.command;
        this._errors = new ProspectDirector.Web.List();
        this.setValueProvider();
    },

    //================================
    // PROPERETIES
    //================================

    get_context: function () {
        return this._context;
    },

    get_command: function () {
        return this._command;
    },

    get_name: function () {
        return this._command.name;
    },

    get_required: function () {
        return this._command.required;
    },

    get_valueProvider: function () {
        return this._valueProvider;
    },

    get_value: function () {
        return this._command.value;
    },

    get_errors: function () {
        return this._errors;
    },

    //================================
    // PUBLIC METHODS
    //================================

    execute: function () {
        return this.get_valueProvider().getValue(this.get_context(), this);
    },

    setValueProvider: function () {

        var factory = new ProspectDirector.Web.UI.Packagers.PackagerValueProviderFactory();

        if (factory) {
            this._valueProvider = factory.getHandler(this);
        }

    }

});