/**
  * Enter description here...
  *
  * @param string $className
  * @return MappedClass
  */
 private function findMappedClass($className)
 {
     /*echo $className ."\n<br>";
     		try {
     			$this->getClassMapLoader()->loadClassMap($className);
     			echo "FOUND -- \n<br>";
     		} catch (ClassMapNotFoundException $ex) {
     			
     			echo $ex->getMessage()." NOT found -- \n<br>";
     		}*/
     foreach ($this->classMaps as $classMap) {
         if ($classMap['className'] == $className) {
             $_class = new SimpleMappedClass();
             $_class->setClassLoader($this->getClassLoader());
             $_class->setSignature($className);
             $_class->setMappedName($classMap['mappedBy']);
             //$_class->setPHPClass($this->classLoader->loadClass($classMap['mappedBy']));
             $_methods = array();
             if (isset($classMap['methods'])) {
                 foreach ($classMap['methods'] as $methodMap) {
                     $_method = new SimpleMappedMethod();
                     $_retClass = $this->loadMappedClass($methodMap['returnType']);
                     if (isset($methodMap['returnTypeCRC'])) {
                         $_retClass->setCRC($methodMap['returnTypeCRC'], true);
                     }
                     $_method->setReturnType($_retClass);
                     $_method->setMappedName($methodMap['mappedName']);
                     $_method->setName($methodMap['name']);
                     $_params = array();
                     foreach ($methodMap['params'] as $paramMap) {
                         $_params[] = $this->loadMappedClass($paramMap['type']);
                     }
                     $_method->setParameterTypes($_params);
                     $_method->setDeclaringMappedClass($_class);
                     $_exceptions = array();
                     if (isset($methodMap['throws'])) {
                         foreach ($methodMap['throws'] as $exceptionMap) {
                             $_exception = new SimpleMappedField();
                             $_exception = $this->loadMappedClass($exceptionMap['type']);
                             if (isset($exceptionMap['typeCRC'])) {
                                 $_exception->setCRC($exceptionMap['typeCRC'], true);
                             }
                             $_exceptions[] = $_exception;
                         }
                     }
                     $_method->setExceptionTypes($_exceptions);
                     $_methods[] = $_method;
                 }
             }
             $_class->setMappedMethods($_methods);
             $_fields = array();
             if (isset($classMap['fields'])) {
                 foreach ($classMap['fields'] as $fieldMap) {
                     $_field = new SimpleMappedField();
                     $_field->setName($fieldMap['name']);
                     $_fieldType = $this->loadMappedClass($fieldMap['type']);
                     if (isset($fieldMap['typeCRC'])) {
                         $_fieldType->setCRC($fieldMap['typeCRC'], true);
                     }
                     $_field->setType($_fieldType);
                     $_field->setDeclaringMappedClass($_class);
                     $_fields[] = $_field;
                 }
             }
             $_class->setMappedFields($_fields);
             if (isset($classMap['extends'])) {
                 $_class->setSuperclass($this->loadMappedClass($classMap['extends']));
             }
             if (isset($classMap['typeCRC'])) {
                 $_class->setCRC($classMap['typeCRC']);
             }
             return $_class;
         }
     }
 }
 private function classMapToMappedClass($classMap, $cachable = true)
 {
     if (null !== $classMap) {
         $className = $classMap['className'];
         $_class = new SimpleMappedClass();
         // to prevent infinitive recursive loop we cache class before initiate it
         if ($cachable) {
             $this->addMappedClassToCache($className, $_class);
         }
         $_class->setClassLoader($this->getClassLoader());
         $_class->setSignature($className);
         if (isset($classMap['mappedBy'])) {
             $_class->setMappedName($classMap['mappedBy']);
         } else {
             $_class->setMappedName($className);
         }
         if (isset($classMap['isInterface']) && $classMap['isInterface'] == 'true') {
             $_class->setInterface(true);
         }
         if (isset($classMap['isAbstract']) && $classMap['isAbstract'] == 'true') {
             $_class->setAbstract(true);
         }
         //$_class->setPHPClass($this->classLoader->loadClass($classMap['mappedBy']));
         $_methods = array();
         if (isset($classMap['methods'])) {
             foreach ($classMap['methods'] as $methodMap) {
                 $_method = new SimpleMappedMethod();
                 $_retClass = $this->loadMappedClass($methodMap['returnType']);
                 if (isset($methodMap['returnTypeCRC'])) {
                     $_retClass->setCRC($methodMap['returnTypeCRC'], true);
                 } else {
                     $crc = SerializabilityUtil::getSerializationSignature($methodMap['returnType']);
                     if (null !== $crc) {
                         $_retClass->setCRC($crc, false);
                     }
                 }
                 $_method->setReturnType($_retClass);
                 $_method->setMappedName($methodMap['mappedName']);
                 $_method->setName($methodMap['name']);
                 $_params = array();
                 foreach ($methodMap['params'] as $paramMap) {
                     $_params[] = $this->loadMappedClass($paramMap['type']);
                 }
                 $_method->setParameterTypes($_params);
                 $_method->setDeclaringMappedClass($_class);
                 $_exceptions = array();
                 if (isset($methodMap['throws'])) {
                     foreach ($methodMap['throws'] as $exceptionMap) {
                         //$_exception = new SimpleMappedField();
                         $_exception = $this->loadMappedClass($exceptionMap['type']);
                         if (isset($exceptionMap['typeCRC'])) {
                             $_exception->setCRC($exceptionMap['typeCRC'], true);
                         } else {
                             $crc = SerializabilityUtil::getSerializationSignature($exceptionMap['type']);
                             if (null !== $crc) {
                                 $_exception->setCRC($crc, false);
                             }
                             //									else {
                             //										require_once(GWTPHP_DIR.'/maps/com/google/gwt/user/client/rpc/SerializableException.class.php');
                             //										throw new SerializableException("Did not found serialization signature for : "
                             //										.$_exception->getName()." in class map file (".$_exception->getName()
                             //										.".gwtphpmap.inc.php). Did you forget to put 'typeCRC' value in array map?.");
                             //									}
                         }
                         $_exceptions[] = $_exception;
                     }
                 }
                 $_method->setExceptionTypes($_exceptions);
                 $_methods[] = $_method;
             }
         }
         $_class->setMappedMethods($_methods);
         $_fields = array();
         if (isset($classMap['fields'])) {
             foreach ($classMap['fields'] as $fieldMap) {
                 $_field = new SimpleMappedField();
                 $_field->setName($fieldMap['name']);
                 $_fieldType = $this->loadMappedClass($fieldMap['type']);
                 if (isset($fieldMap['typeCRC'])) {
                     $_fieldType->setCRC($fieldMap['typeCRC'], true);
                 } else {
                     $crc = SerializabilityUtil::getSerializationSignature($fieldMap['type']);
                     if (null !== $crc) {
                         $_fieldType->setCRC($crc, false);
                     }
                 }
                 $_field->setType($_fieldType);
                 $_field->setDeclaringMappedClass($_class);
                 $_fields[] = $_field;
             }
         }
         $_class->setMappedFields($_fields);
         if (isset($classMap['extends'])) {
             $_class->setSuperclass($this->loadMappedClass($classMap['extends']));
         }
         if (isset($classMap['typeCRC'])) {
             $_class->setCRC($classMap['typeCRC']);
         } else {
             $crc = SerializabilityUtil::getSerializationSignature($className);
             if (null !== $crc) {
                 $_retClass->setCRC($crc, false);
             }
         }
         return $_class;
     } else {
         return null;
     }
 }