protected static void _importFields(final JDefinedClass theClass, final AtomicInteger index, final SimpleStructureDefinition structure) { final JClass parentClass = theClass._extends(); if (parentClass instanceof JDefinedClass) { _importFields((JDefinedClass) parentClass, index, structure); } for (Entry<String, JFieldVar> entry : theClass.fields().entrySet()) { Class<?> fieldClass = ReflectUtil.loadClass(entry.getValue().type().boxify().erasure().fullName()); String fieldName = entry.getKey(); if (fieldName.startsWith("_")) { if (!JJavaName.isJavaIdentifier(fieldName.substring(1))) { fieldName = fieldName.substring(1); // it was prefixed with '_' so we should use the original name. } } structure.setFieldName(index.getAndIncrement(), fieldName, fieldClass); } }
/** * Sets the name of the Java Package to be created * for the ontology. * @param packageName */ public void setJavaPackageName(String packageName){ if(packageName != null && (packageName.length() >= 0) && JJavaName.isJavaPackageName(packageName)) { this.javaPackageName = packageName; } else { throw new IllegalArgumentException("Invalid Java Package Name"); } }
private String pluralizeIfNecessary(CPropertyInfo propertyInfo, final String propertyName) { return (propertyInfo.isCollection() && isUsePluralForm())? JJavaName .getPluralForm(propertyName) : propertyName; }