assert compType != null;
}
catch(IllegalArgumentException ex)
{
throw new UnsupportedThingException(kind, className);
}
// 4. Find the corresponding appropriate base class,
// that is a subclass of Component.
Class compTypeClass = compType.getClass();
Class<? extends Component.Builder> compBuilderClass = null;
if(VisualComponentType.class.isAssignableFrom(compTypeClass))
{
if(GenericComponentType.class.isAssignableFrom(compTypeClass))
{
if(PrimitiveComponentType.class.isAssignableFrom(compTypeClass))
{
compBuilderClass = PrimitiveComponent.Builder.class;
}
else if(CustomComponentType.class.isAssignableFrom(compTypeClass))
{
compBuilderClass = CustomComponent.Builder.class;
}
else if(WidgetComponentType.class.isAssignableFrom(compTypeClass))
{
compBuilderClass = WidgetComponent.Builder.class;
}
}
else if(LayoutComponentType.class.isAssignableFrom(compTypeClass))
{
compBuilderClass = LayoutComponent.Builder.class;
}
}
else // NonVisual
{
if(DataSourceComponentType.class.isAssignableFrom(compTypeClass))
{
compBuilderClass = DataSourceComponent.Builder.class;
}
else if(ParameterComponentType.class.isAssignableFrom(compTypeClass))
{
compBuilderClass = ParameterComponent.Builder.class;
}
else if(CodeComponentType.class.isAssignableFrom(compTypeClass))
{
compBuilderClass = CodeComponent.Builder.class;
}
}
if(compBuilderClass == null)
{
throw new UnsupportedThingException(kind, className);
}
// 5. Return a corresponding IThingReader.
return new CdfdeJsAdhocComponentReader(compBuilderClass, compType);
}
throw new UnsupportedThingException(kind, className);
}