/*
 * Copyright (c) 2003 by Hyperwave AG. All rights reserved.
 */

  /**
   * @author wputz
   */

// <JSClass>
  /**
   * Public constructor, creates an instance of the object value object.
   */
  SortCriteriaVO = function(aParam) {
    if ( aParam == "__proto__" )
      return;

    this.key_       = null;
    this.direction_ = null;
    this.type_      = null;
  }
  //--------------------------------------------------------------------
  // Inheritance call for JavaScript.
  class$ = doInherit (SortCriteriaVO);

  //--------------------------------------------------------------------
  /**
   * Serializes the value object
   *
   * @return String: the serialization of the value object
   */
  class$.serialize = function ()
  {
    var ws = new WebSerializer();

    ws.addValue("k", this.key_);
    ws.addValue("d", this.direction_);
    ws.addValue("t", this.type_);
                          
    return ws.getString();
  }

  //--------------------------------------------------------------------
  /**
   * Serializes the value object to a javascript object
   *
   * @return object: object containing the data of the value object
   */
  class$.serializeToObject = function ()
  {
    var ret = {};

    WebSerializer.static_.setProperty(ret, "k", this.key_);
    WebSerializer.static_.setProperty(ret, "d", this.direction_);
    WebSerializer.static_.setProperty(ret, "t", this.type_);

    return ret;
  }

  //--------------------------------------------------------------------
  /**
   * Creates a new SortCriteriaVO from a given java script object. The object has to be generated
   * from method <code>serializeToObject()</code>
   *
   * @param theObject: object: the values for the new SortCriteriaVO
   * @return SortCriteriaVO: the new value object
   */
  class$.static_.createFromObject = function (theObject)
  {
    var vo = new SortCriteriaVO();

    if (typeof theObject.k != "undefined") vo.key_       = theObject.k;
    if (typeof theObject.d != "undefined") vo.direction_ = theObject.d;
    if (typeof theObject.t != "undefined") vo.type_      = theObject.t;

    return vo;
  }

  //--------------------------------------------------------------------
  /**
   * Deserializes the value object
   *
   * @return SortCriteriaVO: the deserialized value object
   */
  class$.static_.deserialize = function (theString)
  {
    // build a new instance of the value object
    var vo = new SortCriteriaVO();

    var ws = new WebSerializer(theString);

    vo.key_       = ws.getValue("k", "string");
    vo.direction_ = ws.getValue("d", "string");
    vo.type_      = ws.getValue("t", "string");

    // return the newly created value object
    return vo;
  }

  //- <key> -------------------------------------------------------------------
  /**
   * Sets the key.
   *
   * @param aKey: String
   */
  class$.setKey = function (aKey)
  {
    this.key_ = aKey;
  }

  /**
   * Gets the key.
   *
   * @return String
   */
  class$.getKey = function ()
  {
    return this.key_;
  }
  //- <key> -------------------------------------------------------------------

  //- <direction> -------------------------------------------------------------------
  /**
   * Sets the direction.
   *
   * @param aDirection: String
   */
  class$.setDirection = function (aDirection)
  {
    this.direction_ = aDirection;
  }

  /**
   * Gets the direction.
   *
   * @return String
   */
  class$.getDirection = function ()
  {
    return this.direction_;
  }
  //- </direction> -------------------------------------------------------------------

  //- <type> -------------------------------------------------------------------
  /**
   * Sets the type.
   *
   * @param aType: String
   */
  class$.setType = function (aType)
  {
    this.type_ = aType;
  }

  /**
   * Gets the type.
   *
   * @return String
   */
  class$.getType = function ()
  {
    return this.type_;
  }
  //- </type> -------------------------------------------------------------------

// </JSClass>

