ScriptableObject.defineClass(rootScope, clazz);
final ScriptableObject host = (ScriptableObject) clazz.newInstance();
if (SlingWrapper.class.isAssignableFrom(clazz)) {
// SlingWrappers can map to several classes if needed
final SlingWrapper hostWrapper = (SlingWrapper) host;
for (Class<?> c : hostWrapper.getWrappedClasses()) {
SlingWrapFactory.INSTANCE.registerWrapper(c,
hostWrapper.getClassName());
}
} else {
// but other ScriptableObjects need to be registered as
// well
SlingWrapFactory.INSTANCE.registerWrapper(