@Test public void Export() throws IOException { JavaBeanExporter exporter = new JavaBeanExporter(true); exporter.addPackage(TEST.NS, "com.example"); exporter.export(session, new File("target/beanExport")); assertTrue(new File("target/beanExport/com/example/Class1.java").exists()); assertTrue(new File("target/beanExport/com/example/Class1.java").exists()); }
public void export(Session session, File targetFolder) throws IOException { List<EntityType> entityTypes = new ArrayList<EntityType>(); for (OWLClass owlClass : session.findInstances(OWLClass.class)) { if (owlClass.getId().isURI()) { EntityType entityType; if (oneOfAsEnum && !owlClass.getOneOf().isEmpty()) { entityType = createEnumType(owlClass); } else { entityType = createBeanType(owlClass); } entityTypes.add(entityType); } } BeanSerializer beanSerializer = new BeanSerializer(); beanSerializer.setPrintSupertype(true); for (EntityType entityType : entityTypes) { File folder = new File(targetFolder, entityType.getPackageName().replace('.', '/')); folder.mkdirs(); File javaFile = new File(folder, entityType.getSimpleName() + ".java"); javaFile.createNewFile(); Writer writer = new OutputStreamWriter(new FileOutputStream(javaFile), "UTF-8"); try { beanSerializer.serialize(entityType, SimpleSerializerConfig.DEFAULT, new JavaWriter(writer)); } finally { writer.close(); } } }
JavaBeanExporter { public void export(Session session, File targetFolder) throws IOException { List<EntityType> entityTypes = new ArrayList<EntityType>(); for (OWLClass owlClass : session.findInstances(OWLClass.class)) { if (owlClass.getId().isURI()) { EntityType entityType; if (oneOfAsEnum && !owlClass.getOneOf().isEmpty()) { entityType = createEnumType(owlClass); } else { entityType = createBeanType(owlClass); } entityTypes.add(entityType); } } BeanSerializer beanSerializer = new BeanSerializer(); beanSerializer.setPrintSupertype(true); for (EntityType entityType : entityTypes) { File folder = new File(targetFolder, entityType.getPackageName().replace('.', '/')); folder.mkdirs(); File javaFile = new File(folder, entityType.getSimpleName() + ".java"); javaFile.createNewFile(); Writer writer = new OutputStreamWriter(new FileOutputStream(javaFile), "UTF-8"); try { beanSerializer.serialize(entityType, SimpleSerializerConfig.DEFAULT, new JavaWriter(writer)); } finally { writer.close(); } } } }
JavaBeanExporter { public void export(Session session, File targetFolder) throws IOException { List<EntityType> entityTypes = new ArrayList<EntityType>(); for (OWLClass owlClass : session.findInstances(OWLClass.class)) { if (owlClass.getId().isURI()) { EntityType entityType; if (oneOfAsEnum && !owlClass.getOneOf().isEmpty()) { entityType = createEnumType(owlClass); } else { entityType = createBeanType(owlClass); } entityTypes.add(entityType); } } BeanSerializer beanSerializer = new BeanSerializer(); beanSerializer.setPrintSupertype(true); for (EntityType entityType : entityTypes) { File folder = new File(targetFolder, entityType.getPackageName().replace('.', '/')); folder.mkdirs(); File javaFile = new File(folder, entityType.getSimpleName() + ".java"); javaFile.createNewFile(); Writer writer = new OutputStreamWriter(new FileOutputStream(javaFile), "UTF-8"); try { beanSerializer.serialize(entityType, SimpleSerializerConfig.DEFAULT, new JavaWriter(writer)); } finally { writer.close(); } } } JavaBeanExporter(boolean usePrimitives); }
JavaBeanExporter { public void export(Session session, File targetFolder) throws IOException { List<EntityType> entityTypes = new ArrayList<EntityType>(); for (OWLClass owlClass : session.findInstances(OWLClass.class)) { if (owlClass.getId().isURI()) { EntityType entityType; if (oneOfAsEnum && !owlClass.getOneOf().isEmpty()) { entityType = createEnumType(owlClass); } else { entityType = createBeanType(owlClass); } entityTypes.add(entityType); } } BeanSerializer beanSerializer = new BeanSerializer(); beanSerializer.setPrintSupertype(true); for (EntityType entityType : entityTypes) { File folder = new File(targetFolder, entityType.getPackageName().replace('.', '/')); folder.mkdirs(); File javaFile = new File(folder, entityType.getSimpleName() + ".java"); javaFile.createNewFile(); Writer writer = new OutputStreamWriter(new FileOutputStream(javaFile), "UTF-8"); try { beanSerializer.serialize(entityType, SimpleSerializerConfig.DEFAULT, new JavaWriter(writer)); } finally { writer.close(); } } } JavaBeanExporter(boolean usePrimitives); JavaBeanExporter addClassPrefix(String ns, String prefix); JavaBeanExporter addExportNamespaces(String... namespaces); JavaBeanExporter addLocalizedProperty(UID... properties); JavaBeanExporter addPackage(String ns, String packageName); JavaBeanExporter addPropertyAsList(UID... properties); JavaBeanExporter addPropertyAsSet(UID... properties); JavaBeanExporter addPropertyPrefix(String ns, String prefix); void export(Session session, File targetFolder); JavaBeanExporter setDefaultType(Type type); JavaBeanExporter setOneOfAsEnum(boolean b); JavaBeanExporter setStripHasOff(boolean b); }
JavaBeanExporter { public void export(Session session, File targetFolder) throws IOException { List<EntityType> entityTypes = new ArrayList<EntityType>(); for (OWLClass owlClass : session.findInstances(OWLClass.class)) { if (owlClass.getId().isURI()) { EntityType entityType; if (oneOfAsEnum && !owlClass.getOneOf().isEmpty()) { entityType = createEnumType(owlClass); } else { entityType = createBeanType(owlClass); } entityTypes.add(entityType); } } BeanSerializer beanSerializer = new BeanSerializer(); beanSerializer.setPrintSupertype(true); for (EntityType entityType : entityTypes) { File folder = new File(targetFolder, entityType.getPackageName().replace('.', '/')); folder.mkdirs(); File javaFile = new File(folder, entityType.getSimpleName() + ".java"); javaFile.createNewFile(); Writer writer = new OutputStreamWriter(new FileOutputStream(javaFile), "UTF-8"); try { beanSerializer.serialize(entityType, SimpleSerializerConfig.DEFAULT, new JavaWriter(writer)); } finally { writer.close(); } } } JavaBeanExporter(boolean usePrimitives); JavaBeanExporter addClassPrefix(String ns, String prefix); JavaBeanExporter addExportNamespaces(String... namespaces); JavaBeanExporter addLocalizedProperty(UID... properties); JavaBeanExporter addPackage(String ns, String packageName); JavaBeanExporter addPropertyAsList(UID... properties); JavaBeanExporter addPropertyAsSet(UID... properties); JavaBeanExporter addPropertyPrefix(String ns, String prefix); void export(Session session, File targetFolder); JavaBeanExporter setDefaultType(Type type); JavaBeanExporter setOneOfAsEnum(boolean b); JavaBeanExporter setStripHasOff(boolean b);  }