/**
  * Gets the key object for searching, if the object is not initialized, 
  * then do it from skiptoken positional values.
  * 
  * @return mixed
  * 
  * @throws ODataException If reflection exception occurs while accessing 
  *                        or setting property.
  */
 public function getKeyObject()
 {
     if (is_null($this->_keyObject)) {
         $this->_keyObject = $this->_internalOrderByInfo->getDummyObject();
         $i = 0;
         foreach ($this->_internalOrderByInfo->getOrderByPathSegments() as $orderByPathSegment) {
             $index = 0;
             $currentObject = $this->_keyObject;
             $subPathSegments = $orderByPathSegment->getSubPathSegments();
             $subPathCount = count($subPathSegments);
             foreach ($subPathSegments as &$subPathSegment) {
                 $isLastSegment = $index == $subPathCount - 1;
                 $dummyProperty = null;
                 try {
                     // if currentObject = null means, previous iteration did a
                     // ReflectionProperty::getValue where ReflectionProperty
                     // represents a complex/navigation, but its null, which means
                     // the property is not set in the dummy object by OrderByParser,
                     // an unexpected state.
                     if (!$isLastSegment) {
                         $dummyProperty = new \ReflectionProperty($currentObject, $subPathSegment->getName());
                         $currentObject = $dummyProperty->getValue($currentObject);
                     } else {
                         $dummyProperty = new \ReflectionProperty($currentObject, $subPathSegment->getName());
                         if ($this->_orderByValuesInSkipToken[$i][1] instanceof Null1) {
                             $dummyProperty->setValue($currentObject, null);
                         } else {
                             // The Lexer's Token::Text value will be always
                             // string, convert the string to
                             // required type i.e. int, float, double etc..
                             $value = $this->_orderByValuesInSkipToken[$i][1]->convert($this->_orderByValuesInSkipToken[$i][0]);
                             $dummyProperty->setValue($currentObject, $value);
                         }
                     }
                 } catch (\ReflectionException $reflectionException) {
                     throw ODataException::createInternalServerError(Messages::internalSkipTokenInfoFailedToAccessOrInitializeProperty($subPathSegment->getName()));
                 }
                 $index++;
             }
             $i++;
         }
     }
     return $this->_keyObject;
 }