TypeInfo(String xmlName, String javaName) { this.xmlName = xmlName; this.javaNameWithPkg = javaName; this.javaName = org.apache.uima.tools.jcasgen.Jg.removePkg(javaName); this.isArray = false; this.arrayElNameWithPkg = ""; }
/** * Instantiates a new type info. * * @param xmlName the xml name * @param javaName the java name */ TypeInfo(String xmlName, String javaName) { this.xmlName = xmlName; this.javaNameWithPkg = javaName; this.javaName = Jg.removePkg(javaName); this.isArray = false; this.arrayElNameWithPkg = ""; }
/** * Gets the java name. * * @param name the name * @return the java name */ String getJavaName(String name) { if (!hasPkgPrefix(name)) return name; String javaNameWithPkg = getJavaNameWithPkg(name); String simpleName = removePkg(javaNameWithPkg); if (getPkg(javaNameWithPkg).equals(packageName)) return simpleName; if (javaNameWithPkg.equals(imports.get(simpleName))) return simpleName; return javaNameWithPkg; }
/** * Collect import. * * @param casName the cas name * @param _Type the type */ void collectImport(String casName, boolean _Type) { if (!hasPkgPrefix(casName)) return; String javaNameWithPkg = getJavaNameWithPkg(casName); if (nonImportableJavaNames.contains(javaNameWithPkg)) return; String pkg = getPkg(javaNameWithPkg); if (pkg.equals(packageName)) return; if (_Type) javaNameWithPkg += "_Type"; String simpleName = removePkg(javaNameWithPkg); if (simpleName.equals(simpleClassName)) return; if (null == imports.get(simpleName)) { if (_Type) _imports.put(simpleName, javaNameWithPkg); else imports.put(simpleName, javaNameWithPkg); } }
/** * Generate type classes from the specified templates. * * @param td TypeDescription object * @param outputDirectory output directory * @param jcasTypeInstance Template instance used to generate class * @return void * @throws IOException - */ private void generateClassesFromTemplate(TypeDescription td, String outputDirectory, IJCasTypeTemplate jcasTypeInstance) throws IOException { simpleClassName = removePkg(getJavaName(td)); generateClass(progressMonitor, outputDirectory, td, jcasTypeInstance.generate(new Object[] { this, td }), getJavaName(td), merger); // simpleClassName = removePkg(getJavaName_Type(td)); // generateClass(progressMonitor, outputDirectory, td, jcas_TypeInstance.generate(new Object[] { // this, td }), getJavaName_Type(td), merger); }