if ( object instanceof Collection ) {
kpkgs = (Collection<KnowledgePackage>) object;
} else if ( object instanceof KnowledgePackageImp ) {
kpkgs = Collections.singletonList( (KnowledgePackage) object );
} else if( object instanceof Package ) {
kpkgs = Collections.singletonList( (KnowledgePackage) new KnowledgePackageImp( (Package) object ) );
} else if( object instanceof Package[] ) {
kpkgs = new ArrayList<KnowledgePackage>();
for( Package pkg : (Package[]) object ) {
kpkgs.add( new KnowledgePackageImp( pkg ) );
}
} else {
throw new RuntimeException("Unknown binary format trying to load resource "+resource.toString());
}
for( KnowledgePackage kpkg : kpkgs ) {