public static UIDescriptor getUIDescriptor(String role, JComponentFactory factory) throws IOException {
if(role==null)
throw new IllegalArgumentException("role is null");
if(factory==null)
throw new IllegalArgumentException("factory is null");
UIDescriptor desc = new UIDescriptor();
desc.role = role;
desc.toolkit = JComponentFactory.TOOLKIT;
desc.attributes = Collections.singleton(new UIFactoryTypes(Collections.singleton(JComponentFactory.TYPE_NAME)));
desc.factory = new MarshalledObject<JComponentFactory>(factory);
return (desc);