xautoload classes in subfolders I have issues autoloading classes found in subfolders of my module with xautoload.

my module is called myentity

Here is my hook_entity_info

function myentity_entity_info() {
    $return['myentity'] = array(
        'label' =&gt; t('My entity'),
// The entity class and controller class extend the classes provided by the
// Entity API
        'entity class' =&gt; 'Drupal/myentity/class/MyEntity',
        'controller class' =&gt; 'Drupal/myentity/controller/MyEntityController',
        'base table' =&gt; 'myentity',
        'fieldable' =&gt; TRUE,
        'entity keys' =&gt; array(
            'id' =&gt; 'me_id',
            ),
        'bundles' =&gt; array(
        'myentity' =&gt; array(
            'label' =&gt; 'myentity',
        // Information below is used by the Field UI - they "attach" themselves here and lets us
        // do the standard field management that all the core entities enjoy.
            'admin' =&gt; array(
                'path' =&gt; 'admin/structure/myentity/manage',
                'access arguments' =&gt; array('administer myentity'),
                ),
            ),
        ),
    'label callback' =&gt; 'entity_class_label',
    'uri callback' =&gt; 'entity_class_uri',
    'module' =&gt; 'myentity',
    'view modes' =&gt; array(
        'full' =&gt; array(
            'label' =&gt; t('Default'),
            'custom settings' =&gt; FALSE,
        ),
        'teaser' =&gt; array(
            'label' =&gt; t('Teaser'),
            'custom settings' =&gt; FALSE,
        ),
    ),
    'metatags' =&gt; TRUE,
);

return $return;
}


My class and controller are found in 

sites\all\modules\myentity\lib\Drupal\class\MyEntity.php


with the following content

&lt;?php

namespace Drupal\myentity\class\MyEntity;

/**
 * The class used for model entities
 */
class MyEntity extends Entity {

    public function __construct($values = array()) {
        parent::__construct($values, 'myentity');
    }

    protected function defaultLabel() {
        return $this-&gt;name;
    }

    protected function defaultUri() {
        return array('path' =&gt; 'myentity/' . $this-&gt;identifier());
    }


}


and

sites\all\modules\myentity\lib\Drupal\controller\MyEntityController.php
Bugs bugs bugs.

    'entity class' =&gt; 'Drupal/myentity/class/MyEntity',
    'controller class' =&gt; 'Drupal/myentity/controller/MyEntityController',


This should be

    'entity class' =&gt; 'Drupal\myentity\class\MyEntity',
    'controller class' =&gt; 'Drupal\myentity\controller\MyEntityController',


And:

namespace Drupal\myentity\class\MyEntity;


This should be

namespace Drupal\myentity\class;


(and btw, is "class" really a valid namespace part? Won't PHP complain?)

And:

sites\all\modules\myentity\lib\Drupal\controller\MyEntityController.php


This should be:

sites\all\modules\myentity\lib\Drupal\myentity\controller\MyEntityController.php


EDIT: One more:

class MyEntity extends Entity {


should be

class MyEntity extends \Entity {


Because class Entity is in root namespace.